Defect #4857
closedWeek number calculation in date picker is wrong if a week starts with Sunday
0%
Description
The date-picker always displays the wrong week-number if you set the week to start with Sunday.
This behavior comes from the fact that the date-picker tries to find the week number based on the nearest Thursday to the first day of the respective week. It selects the following Thursday if the week starts with a Monday but the previous one if it starts with Sunday.
This however is the wrong approach as it should always select the Thursday of the current week (i.e. the following Thursday for this purpose). Otherwise the week number is always one off (or at least in 2009 and 2010).
The attached patch fixes this behavior and always selects the Thursday of the week of the given date. It thus provides the correct ISO 8601 week.
Note that you will still get in trouble in 2011, as the definition of the ISO 8601 week number as used in Europe (first week is the week which includes the Jan 4th) differs from the US week numbers (first week is the week which includes Jan 1st). So it might be a good idea to make the week-base configurable.
Files
Related issues