calc: function WEEKNUM seems not to conform to ODFF1.2

Winfried Donkers W.Donkers at dci-electronics.nl
Fri Jun 1 01:07:00 PDT 2012


Hi,

Whilst working on function ISOWEEKNUM (fdo 50488), I found that function WEEKNUM has a different behaviour as defined in ODFF1.2.
The difference is in interpreting parameter Mode:

ODF1.2 states: 
(default value for Mode = 1)
Constraints: 1 ≤ Mode ≤ 2, or 11 ≤ Mode ≤ 17, or Mode = 21, or Mode = 150
For Mode={1, 2, 11, 12, ..., 17} the week containing January 1 is the first week of the year, and is numbered week 1. The week starts on {Sunday, Monday, Monday, Tuesday, ..., Sunday}.
Mode 21 or 150 are both [ISO8601], the week starts on Monday and the week containing the first Thursday of the year is the first week of the year, and is numbered week 1.

calc uses the following:
Mode = 1 :  Sunday is first day of week
Mode != 1 : Monday is first day of week
Definition of when week 1 starts is always as in ISO 8601.

I would like to change the behaviour of function WEEKNUM to conform to ODFF1.2 (core/tools/source/datetime/tdate.cxx, Date::GetWeekOfYear(..) allows this), but before enter a bug and start working on it, I would like to hear if there are reasons to keep WEEKNUM as it is (and change the documentation to state that the function differs from ODFF1.2).



Winfried




More information about the LibreOffice mailing list