https://bugs.freedesktop.org/show_bug.cgi?id=71170

          Priority: medium
            Bug ID: 71170
          Assignee: [email protected]
           Summary: WEEKNUM needs corresponding YEAR functionality
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: [email protected]
          Hardware: Other
            Status: UNCONFIRMED
           Version: 4.1.3.2 rc
         Component: Spreadsheet
           Product: LibreOffice

Per ISO-8601, the year that's used with the Week Number isn't always the same
as the Gregorian calendar year for the specific date.  In particular, when a
week straddles two years, it is considered to be part of whichever year the
majority of the week's days fall under.  As an example, the week that contains
Saturday, January 1, 2000 is Week 52 of 1999, because every other day of that
week falls in 1999.  Conversely, the week that contains Monday, December 31,
2000 is Week 1 of 2001 because the rest of that week falls in 2001.   

Currently, there is no easy way to reliably get the year corresponding to the
week number (e.g., "1999" for January 1, 2000, and "2001" for December 31,
2000).  Proposed solution: add a WEEKNUM_YEAR function that returns the year
corresponding to WEEKNUM.  The WEEKNUM_YEAR function should take a second
parameter that lets you adjust the results based on whether you want the week
to begin on a Sunday or a Monday, just like WEEKNUM does.  

Likewise, I suspect that there's no way to format a Date so that January 1,
2000 will display as "1999-W52-7" and December 31, 2000 will display as
"2001-W01-1": YYYY produces the Gregorian year, not the "week-number year".  

Note that ISO-8601 assumes that week numbers will never be mixed with ordinal
days (e.g., December 31, 2000 is day 366 of 2000) or months when displaying the
date, and that including a week number in the date's formatting code therefore
implies that the year will be presented as the week-number year instead of the
Gregorian year.  For full compliance with the ISO-8601 standard, LibreOffice
should probably do the same: if week-number formatting is included, then YY and
YYYY should present the week number's year instead of the Gregorian year. 
However, there should probably be some means of overriding this behavior,
letting the user explicitly ask for either the Gregorian year or the week
number's year as he sees fit.  But I'm not sure how that would be handled.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to