Bug 71170 - WEEKNUM needs corresponding YEAR functionality
Summary: WEEKNUM needs corresponding YEAR functionality
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.3.2 release
Hardware: All All
: lowest enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2013-11-02 19:33 UTC by dataweaver
Modified: 2021-07-04 06:11 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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
Comment 2 Robert Barton 2020-04-13 14:20:33 UTC Comment hidden (spam)
Comment 3 Adelina Brown 2020-12-10 11:39:27 UTC Comment hidden (spam)
Comment 4 John Wright 2020-12-11 07:28:08 UTC Comment hidden (spam)