26
TRex
7y

While working on my one of the first project in java i ended up using deprecated Calendar API for the date. Since deadline was near i thought it would be a good idea to use the JCalendar API for as date picker (which is a third party API).BAD IDEA. It was the night before the submission round about 11pm when i realized that there is no way to convert JCal object into Calendar and it turned out it is not working as expected you have to subtract a particular number from the year to get date right.

To convert JCal into Calendar i used the toString function to get the date in string sliced it using substring into year,month,day then had to assign date to Calendar object via constructor.
Had to write 70 lines of code just to convert JCal into Calendar...

And then there were other complications related to this problem. Had tu pull an all nighter just to solve date related problems
LESSONS LEARNED :
NEVER USE A DEPRECATED API
NEVER USE THIRD PARTY APIs WITHOUT RESEARCH

Comments
  • 7
    Pat yourself on the back you achieved fixing two semi non compatible architecture to work together. Maybe look into writing your own library :) glad you made the deadline we all been there lol
  • 0
    Check java 8 time(joda?) and JavaFX. Good shit.
  • 1
    Any reason for using

    .comoareToIgnoreCase("") == 0

    Instead of

    .equalsIgnoreCase('")

    ?
  • 1
    @AlgoRythm switching from Cpp it was my first project in java, wasn't familiar with the syntx.
  • 0
    Instead of if-else if-else try to use switch
  • 0
    @andr3w000 but the condition on the if changes for every case, he's not looking at the values of a statement!
  • 0
    @7Raiden didn't notice that, my bad :)
Add Comment