views:

639

answers:

5

Hi,

I'm using jQuery DatePicker and it shows wrong date for November, 2009.

You can see this in my sample page.

http://project-base-23.codepremise.com/door/test_calendar

Is this a known bug? How can I fix it?

Thanks.

Sam

A: 

Date isn't wrong, you just have date format mm/dd/Y, so November 18th 2009 is 11/18/2009.

Or have I misunderstood your question? :)

usoban
In November, 2009, There are two '1' (Sunday and Monday).
Sam Kong
A: 

It works fine for me. You do realize that the calendar has Sunday set as the first day, right? Because that shifts the "look" of the calendar by one day.

If there is some other error, please explain a bit deeper what you're getting/expecting.

peirix
I am sorry that my question was not clear. In November this year, there are two '1'.
Sam Kong
A: 

Yes there is a problem with November, 2009. Apparently this problem was also visible in November, 2008 except it was with the 2nd of November, not the 1st. I'm dealing with the EXACT same issue. I found two suggestions elsewhere that I am going to try. They may be helpful to you as well:

I found this advice at http://www.nabble.com/bug-in-date-display-in-jquery-date-picker-td20341195s27240.html from a posting in 2008! " The bug is fixed by replacing line 1308 with:

printDate.setDate(printDate.getDate() + 1);

instead of the UTC version. Haven't done any regression testing, but it seems to work. " The other suggestion was to upgrade the version which also makes a lot of sense.

Does anyone know if this is the way to go?

+2  A: 

The issue is daylight savings. Essentially, because of the "fall back" of one hour, November 1st has 25 hours. The bug is resolved in the most recent version of datepicker: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/scripts/jquery.datePicker.js.

That's what it does...

Sensei James
A: 

We had the same problem. Not only were there two Nov 1, 2009, but each Monday following the first Sunday of November in any year was a duplicate date. As Dawn suggested, changing this line of code

printDate.setUTCDate(printDate.getUTCDate() + 1);

to this

printDate.setDate(printDate.getDate() + 1);

seems to have solved the problem.

Dan