Search and Top Navigation
#4285 closed bug (fixed)
Opened March 06, 2009 01:24PM UTC
Closed April 01, 2009 10:41AM UTC
Last modified October 11, 2012 09:15PM UTC
Week of the Year off by one during daylight saving time
Reported by: | scarstens | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | ui.datepicker | Version: | |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If you enable the display of the week in datepicker and switch to
march 2009. DST starts at the end of march in germany. The Week 13
will be display double. At the end of the year the Weeks realign with
reality when DST ends.
The difference between the selected date and the first day of the first week is calculated. Then this is devided by 7 to get the week number. If there is a change in the timezone between these dates the difference in days will be with a fraction (9.95). The end result is rounded with Math.floor but the intermediate step for the days has to be rounded with Math.round
Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1;
needs to be
Math.floor(Math.round((checkDate - firstMon) / 86400000) / 7) + 1;
diff attached
Bump!
This fix is also needed for week displaying: http://dev.jqueryui.com/ticket/4131