Ticket #4285 (closed bug: fixed)

Opened 18 months ago

Last modified 17 months ago

Week of the Year off by one during daylight saving time

Reported by: scarstens Owned by:
Priority: minor Milestone: TBD
Component: ui.datepicker Version:
Keywords: Cc:

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

Attachments

ui.datepicker.week-fix.diff Download (401 bytes) - added by scarstens 18 months ago.
Diff

Change History

Changed 18 months ago by scarstens

Diff

Changed 18 months ago by hub

Bump!

This fix is also needed for week displaying: http://dev.jqueryui.com/ticket/4131

Changed 17 months ago by kbwood

  • status changed from new to closed
  • resolution set to fixed

Fixed in r2423.

Note: See TracTickets for help on using tickets.