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 452876 - week-in-year does not return ISO8601 week numbers
week-in-year does not return ISO8601 week numbers
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2007-07-01 15:58 UTC by Maurice van der Pot
Modified: 2007-10-10 14:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Corrects week-of-year to return ISO6801 week numbers (2.18 KB, patch)
2007-07-01 16:01 UTC, Maurice van der Pot
needs-work Details | Review

Description Maurice van der Pot 2007-07-01 15:58:27 UTC
I've created a patch to fix week-in-year, added some test cases and also changed some existing test cases because they were expecting incorrect week numbers.
Comment 1 Maurice van der Pot 2007-07-01 16:01:46 UTC
Created attachment 90975 [details] [review]
Corrects week-of-year to return ISO6801 week numbers

Patch against latest SVN.
Comment 2 Daniel Veillard 2007-08-23 10:06:18 UTC
I don't see how this is actually a progress:

without the patch applied the exslt/date/date.1 test shows

  Test Date : 0001-12-31Z
    year                 : 1
    leap-year            : false
    month-in-year        : 12
    month-name           : December
    month-abbreviation   : Dec
    week-in-year         : 53
    day-in-year          : 365
    day-in-month         : 31

which looks correct for a 31 December
with the patch the same test shows:

  Test Date : 0001-12-31Z
    year                 : 1
    leap-year            : false
    month-in-year        : 12
    month-name           : December
    month-abbreviation   : Dec
    week-in-year         : 1
    day-in-year          : 365
    day-in-month         : 31

  How can that be the first week of the year ? To me this makes no sense
and the patch introduce a strong regression, something which worked looks
not working anymore. I think you would have to explain the changes to the
regression tests data instead of just stating they are incorrect. I don't
see how the definition of exslt:date can lead to such a result:
  http://www.exslt.org/date/functions/week-in-year/index.html

  As-is the patch looks broken to me, but I may be convinced if you
have data to back this out:
Comment 3 Maurice van der Pot 2007-08-23 11:37:52 UTC
I incorrectly referred to ISO 6801, which should have been ISO 8601. Doh!

But to give some references to where I got this information:
http://en.wikipedia.org/wiki/Week#Week_number
http://en.wikipedia.org/wiki/ISO_8601#Week_dates

Taken from the ISO 8601:2004(E) pdf that was referenced in the latter:
"2.2.10
calendar week number
ordinal number which identifies a calendar week within its calendar year according to the rule that the first calendar week of a year is that one which includes the first Thursday of that year and that the last calendar week of a calendar year is the week immediately preceding the first calendar week of the next calendar year."

The definition of exslt:date states: 
"week 1 in a year is the week containing the first Thursday of the year, with new weeks beginning on a Monday."
If January 1 is a Thursday, that week will be week 1 and December 31 will be in it.
Comment 4 Daniel Veillard 2007-10-10 14:36:47 UTC
Okay with all informations in place, yes this looks like a genuine
bug, it was not conforming to the eXSLT definition, so patch
applied and commited to SVN head,

  thanks a lot for the report and the patch !

Daniel