After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 616330 - WEEKNUM incompatibility
WEEKNUM incompatibility
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Analytics
git master
Other Linux
: Normal normal
: ---
Assigned To: Morten Welinder
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2010-04-20 19:26 UTC by Andreas J. Guelzow
Modified: 2010-04-22 18:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Tentative patch (2.43 KB, patch)
2010-04-21 13:54 UTC, Morten Welinder
none Details | Review

Description Andreas J. Guelzow 2010-04-20 19:26:41 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.
Comment 1 Morten Welinder 2010-04-21 12:41:46 UTC
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.
Comment 2 Morten Welinder 2010-04-21 13:54:01 UTC
Created attachment 159255 [details] [review]
Tentative patch

Patch for the goffice side.  Gnumeric docs need fixing too.
Comment 3 Andreas J. Guelzow 2010-04-21 18:20:07 UTC
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.
Comment 4 Morten Welinder 2010-04-22 18:29:31 UTC
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.