Project

General

Profile

Actions

Defect #4857

closed

Week number calculation in date picker is wrong if a week starts with Sunday

Added by Holger Just about 14 years ago. Updated almost 14 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
UI
Target version:
Start date:
2010-01-17
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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

calender.patch (607 Bytes) calender.patch Holger Just, 2010-02-17 12:57

Related issues

Related to Redmine - Defect #17625: Wrong week number in JQuery datepicker if start of week day is SundayClosed

Actions
Has duplicate Redmine - Defect #3271: Wrong week number in CalendarClosed2009-04-30

Actions
Has duplicate Redmine - Defect #3060: Week numbers dont match in reports and calendar popupsClosed2009-03-27

Actions
Actions

Also available in: Atom PDF