Bug 71170

Summary: WEEKNUM needs corresponding YEAR functionality
Product: LibreOffice Reporter: dataweaver
Component: SpreadsheetAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: lowest CC: jmadero.dev
Version: 4.1.3.2 release   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description dataweaver 2013-11-02 19:33:31 UTC
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.
Comment 1 Joel Madero 2014-05-05 04:45:18 UTC
Thank you for reporting this enhancement request! I can confirm that this is a valid enhancement request on:
Version: 4.3.0.0.alpha0+ Build ID: 84862db95a5e22b9ef89baa2a8a5deeffefbdef6
Date:   Thu Apr 24 21:43:16 2014 +0300
Platform: Ubuntu Linux 14.04 x64
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
As I've been able to confirm the enhancement request I am marking as:

New (confirmed)
Enhancement
Lowest - I don't see this being horribly useful for many people (note no comments in over 6 months) but none the less a valid request.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link:
https://wiki.documentfoundation.org/QA/BugTriage

There are also other ways to get involved including with marketing, UX, documentation, and of course developing -  http://www.libreoffice.org/get-help/mailing-lists/. 

Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.