Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#4866 closed bug (wontfix)

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.

Change History (4)

comment:1 Changed 10 years ago by amarlot

Hi,

I found this bug too in the same situation.

Any Workaround for this bug ? Thanks

comment:2 Changed 10 years ago by Jörn Zaefferer

Milestone: TBD1.8

comment:3 Changed 10 years ago by kbwood

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}).

comment:4 Changed 10 years ago by aeischeid

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.

Note: See TracTickets for help on using tickets.