Weird DatePicker behavior with some dates #47

lucascorbeaux opened this Issue Sep 29, 2009 · 1 comment


None yet
2 participants

Hi there,

As mentionned here and here some dates break the DatePicker.

I'm sure that's an issue, as you can reproduce the bug in the tutorial/demo section here :

Try to type any november date prior to 2009, like 2007-11-07, and all calendar's cases will be filled by the same number (28 for this example). Works the same way on FF or IE.

As the previous issues were posted several months ago, is there a chance to get an answer, or even an hint to fix the problem ourselves ?

The issue is with Daylights savings.
ie: Nov 1, 2009 to Nov 2nd, Daylights savings means Nov 1 + 24 hours of seconds gets you to Nov 1, 23:00. Because it sets the hour, Nov 1 23:00 becomes Nov 1, 00:00, and you end up repeating the date.

Ended up adding a bit of code to fillCalendar method:

@@ -13629,13 +13629,15 @@ var DatePicker;
                        var atDate = startDate.clone();
+                       // deal with a daylight savings time issue, see: Nov 1st, 2009
+                       var incrementTime = + (Date.units.hour() * 2);
                        this.rows.each(function(row, i){
                                if (i < 2) return;
                                        atDate.set('hours', hours);
                               = atDate.getDate();
                                        td.refDate = atDate.getTime();
-                                       atDate.setTime(atDate.getTime() +;
+                                       atDate.setTime(atDate.getTime() + incrementTime);
                                }, this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment