GNOME Bugzilla – Bug 616330
WEEKNUM incompatibility
Last modified: 2010-04-22 18:29:31 UTC
On Excel, WEEKNUM of January 1, any year always returns 1, i.e week 1 always contains January 1. On Gnumeric, WEEKNUM of January 1 is sometimes 1 but mostly 0. It is 1 if January 1 is the start of a week, 0 otherwise. Since we also have isoweeknum I see no point in having an incompatible WEEKNUM.
The code comes down to g_date_get_sunday_week_of_year. That is in conflict with the Excel function. go_date_weeknum follows glib.
Created attachment 159255 [details] [review] Tentative patch Patch for the goffice side. Gnumeric docs need fixing too.
According to ECMA OfficeOpen XMLPart 4 3.17.7.342 WEEKNUM there are only 1 and 2 and January 1 is always in week 1. Of course ECMA OfficeOpen XMLPart 4 3.17.7.342 WEEKNUM has become IS 29500-1:2008 and things are much more convoluted: mode: 21: Week begins on Monday and the week containing the first Thursday of the year is the first week of the year, and is numbered as week 1 [ISO 8601]. This should be our mode 150. 1: Week begins on Sunday, January 1 is always in week 1. 2: Week begins on Monday, January 1 is always in week 1. 11: Week begins on Monday, January 1 is always in week 1. 12: Week begins on Tuesday, January 1 is always in week 1. ... 17: Week begins on Sunday, January 1 is always in week 1. so mode 11 is the same as mode 2, and mode 17 is the same as mode 17.
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report. For now we ignore 11-17. We do handle 21.