Opened 12 years ago

Closed 10 years ago

#2504 closed enhancement (wontfix)

New methods for getting and setting the week of the year.

Reported by: james@… Owned by: Neil Roberts
Priority: high Milestone: future
Component: Dojox Version: 0.4.1
Keywords: Cc: psowden
Blocked By: Blocking:

Description (last modified by Adam Peller)

I have generalized the methods for getting and setting the ISO8601 week added in ticket #2479. The new getWeekOfYear(), setWeekOfYear(), and getWeeksInYear() methods take both "firstDay" and "minDays" arguments. firstDay sets the number of the first day of the week (Sunday=0, Monday=1), while minDays specifies the minimum number of days required to make a week. firstDay defaults first to the value of dojo.date.getFirstDayOfWeek() and then to 0 (Sunday), and minDays defaults to 1.

The ISO8601 week methods have been changed to call these new methods. ISO8601 uses firstDay=1 (Monday) and minDays=4.

Some unit tests are included, but I could not find many test cases for the new methods. If anyone can point out a set of calculated week numbers then I will add appropriate unit tests. The ISO8601 methods are tested with data from http://www.merlyn.demon.co.uk/week-cal.txt

Attachments (1)

weeks.patch (14.5 KB) - added by james@… 12 years ago.
General methods for getting and setting week numbers.

Download all attachments as: .zip

Change History (10)

Changed 12 years ago by james@…

Attachment: weeks.patch added

General methods for getting and setting week numbers.

comment:1 Changed 12 years ago by Adam Peller

Cc: psowden added
Owner: changed from psowden to Adam Peller

comment:2 Changed 12 years ago by Adam Peller

xref #2024

comment:3 Changed 12 years ago by Adam Peller

Component: DateDojox
Milestone: 0.9

comment:4 Changed 12 years ago by Adam Peller

Milestone: 0.91.0

comment:5 Changed 12 years ago by Adam Peller

Milestone: 1.01.1

comment:6 Changed 12 years ago by Adam Peller

Milestone: 1.12.0

comment:7 Changed 12 years ago by alex

Milestone: 2.01.3

Milestone 2.0 deleted

comment:8 Changed 11 years ago by Adam Peller

Description: modified (diff)
Milestone: 1.3future
Owner: changed from Adam Peller to Neil Roberts

Some of these methods are implemented in dojox.date.posix, but are probably incomplete. Neil, perhaps you'd be interested in comparing the impls and using some of the tests?

comment:9 Changed 10 years ago by Neil Roberts

Resolution: wontfix
Status: newclosed

Very old, code doesn't seem to exist anymore. None of my code is applicable.

Note: See TracTickets for help on using tickets.