Opened 11 years ago

Closed 7 years ago

#6241 closed defect (patchwelcome)

dojox.date.posix.getIsoWeekOfYear: Week 53 in 2007?

Reported by: guest Owned by: Adam Peller
Priority: high Milestone: future
Component: Dojox Version: 1.1b1
Keywords: week number, date, iso8601, posix, getIsoWeekOfYear Cc: haavikko@…
Blocked By: Blocking:

Description (last modified by Adam Peller)

There seems to be a mismatch between dokumentation and code in dojox.date.posix handling of getIsoWeekOfYear.

getIsoWeekOfYear gives week number 53 for Monday, December 31, 2007. tests/posix.js validates this behavior:

	week = dojox.date.posix.getIsoWeekOfYear(new Date(2007,11,31));
	t.is(53, week);
	week = dojox.date.posix.getIsoWeekOfYear(new Date(2008,0,1));
	t.is(1, week);

The documentation however says that

	//   The week containing January 4th is the first week of the year.

According to Wikipedia http://en.wikipedia.org/wiki/ISO_week_date:

The following years have 53 weeks:
    * years starting with Thursday
    * leap years starting with Wednesday

Also: http://en.wikipedia.org/wiki/ISO_8601

The ISO year starts at the first day (Monday) of
week 01 and ends at the Sunday before the new 
ISO year (hence without overlap or gap)

Whereas in the current implementation, the first week of 2008 seems to begin on Tuesday.

Change History (2)

comment:1 Changed 11 years ago by Adam Peller

Description: modified (diff)
Milestone: future

The ISO code is very old and never followed the spec. Would welcome patches for the ISO date code. No cycles for it atm.

comment:2 Changed 7 years ago by Adam Peller

Resolution: patchwelcome
Status: newclosed
Note: See TracTickets for help on using tickets.