Skip to main content

Search and Top Navigation

#4866 closed bug (wontfix)

Opened September 18, 2009 06:57PM UTC

Closed November 30, 2009 12:47AM UTC

Last modified February 05, 2010 08:32PM UTC

showWeek goes to 53 for subsequent year

Reported by: dmfontz Owned by:
Priority: minor Milestone: 1.8
Component: ui.datepicker Version: 1.8a1
Keywords: showweek week Cc:
Blocked by: Blocking:
Description

the showWeek function goes to week 53 when flipping from current year into January of subsequent year.

See: http://jsbin.com/omaqe/edit

Open the datepicker and click months to get to Jan of next year.

Attachments (0)
Change History (4)

Changed November 13, 2009 12:53PM UTC by amarlot comment:1

Hi,

I found this bug too in the same situation.

Any Workaround for this bug ?

Thanks

Changed November 16, 2009 03:57PM UTC by jzaefferer comment:2

milestone: TBD1.8

Changed November 30, 2009 12:47AM UTC by kbwood comment:3

resolution: → wontfix
status: newclosed

This is correct. The week of the year is calculated based on the first date shown in each week - in this case each Sunday. The ISO 8601 definition of a week states that a week starts on a Monday and that the first week of the year contains the first Thursday of the year. Thus, for 2010, the first week of the year is Mon Jan 4 through Sun Jan 10. So, Sun Jan 3 belongs to week 53 of the previous year and since this is the first day shown in the week, 53 is the number of the week shown.

To correctly display the week number you should always start the week on a Monday: datepicker({firstDay: 1}). Alternately, you can define your own week calculation function and use that instead: datepicker({calculateWeek: myweek}).

Changed February 05, 2010 08:32PM UTC by aeischeid comment:4

My opinion is that this is a bug. At least it is very confusing to US users. Perhaps a solution would be to determine the week number to display based not on the first day of the week or the first column in the calendar, but rather base it on the Thursday column.

basically this would just require passing a different date into the iso8601Week function or adding 3 or 4 to the date that gets passed in... shouldn't be hard anyway.