Bug 139342 - LibreOffice counts weeknumbers wrong, starting in 2021...
Summary: LibreOffice counts weeknumbers wrong, starting in 2021...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: preBibisect
Depends on:
Blocks:
 
Reported: 2020-12-31 15:17 UTC by Marqeaux
Modified: 2020-12-31 18:19 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
See the mismatch in week numbering (10.11 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-12-31 15:20 UTC, Marqeaux
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marqeaux 2020-12-31 15:17:37 UTC
Description:
When using a formula for counting the week numbers, LibreOffice counts it wrong. The reason is because 2020 has 53 weeks instead of 52. LibreOffice Calc doesn't recognize week 53, so it starts counting at week 1, starting this coming year 2021. The result of it is that LibreOffice will be one week behind in counting weeks.

The attachement shows what I mean...

Steps to Reproduce:
1. Open a Calc document
2. Use the formula for counting week numbers (don't know the name of that formula in English
3. See that the weeknumber will be one week behind, starting in 2021

Actual Results:
Week 1 - 2021 instead of week 53 - 2020, and so on starting from the last week of 2020....

Expected Results:
 


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Recognize week 53 to make the week numbering correct again.
Comment 1 Marqeaux 2020-12-31 15:20:08 UTC
Created attachment 168605 [details]
See the mismatch in week numbering

Week number 53 in 2020 is shown as week 1 in 2021. That's not correct, because 2020 has 53 weeks. It causes problems with week numbering when you use a formula to count them.
Comment 2 Martin Srdoš 2020-12-31 15:49:36 UTC
Hello Marqeaux,

Thank you for reporting the bug. It should be so, how you say: https://en.wikipedia.org/wiki/ISO_week_date

I can confirm that the bug is present in master.

Version: 7.2.0.0.alpha0+ (x64)
Build ID: c0eee433e079d8e3413f4691607e075b99af92b0
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: en-US
Calc: threaded
Comment 3 Julien Nabet 2020-12-31 18:13:20 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

Here's a code pointer:
https://opengrok.libreoffice.org/xref/core/tools/source/datetime/tdate.cxx?r=445537bb#340

I see there's a wrong calculation here but don't know what was the intention.
Comment 4 Regina Henschel 2020-12-31 18:19:06 UTC
The function WEEKNUM has a second parameter to determine, which calculating system to use. For getting ISO system, you need mode 21.
=WEEKNUM(DATE(2021;1;1);21)
https://help.libreoffice.org/7.2/en-US/text/scalc/01/func_weeknum.html?DbPAR=CALC#bm_id3159161

Or you use directly ISOWEEKNUM.
=ISOWEEKNUM(DATE(2021;1;1))
https://help.libreoffice.org/7.2/en-US/text/scalc/01/func_isoweeknum.html?DbPAR=CALC#bm_id3159161