https://bugs.documentfoundation.org/show_bug.cgi?id=170339

            Bug ID: 170339
           Summary: WEEKNUM function output differs from MS Excel in
                    "System 1"
           Product: LibreOffice
           Version: 25.8.3.2 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
In "System 1", the Weeknum function outputs a different result than Excel for
the last week of the year (unless 31.12. is a Saturday)

Excel 365 MSO (Version 2502) 64-bit 
=WEEKNUM(DATE(2000;12;31);1)  -> 54
=WEEKNUM(DATE(2021;12;31);1)  -> 53
=WEEKNUM(DATE(2005;12;31);1)  -> 53

LibreOffice 25.8.3.2
=WEEKNUM(DATE(2000;12;31);1)  -> 1
=WEEKNUM(DATE(2021;12;31);1)  -> 1
=WEEKNUM(DATE(2005;12;31);1)  -> 53


The help function (neither Excel, nor Libreoffice,
https://help.libreoffice.org/latest/en-US/text/scalc/01/func_weeknum.html?&DbPAR=SHARED&System=UNIX)
explicitly mention how the rollover to the next year shall be treated.

The LibreOffice solution seems to be inspired by the "ISO format logic", where
each week has a unique calendar week number assigned (however, which is however
anyway not the case for the first days of January, which always get assigned a
1, as intended)

The Excel solution seems logical from the point of view that when talking about
year x, week 1 of year x is in January, so there should not be a rollback in
December.
For consecutive tasks (each week +1), the Excel function implementation is more
helpful since it avoids case distinctions.

While the help function does not specify the rollover, another article by MS
indicates that the output I get in Excel is the intended one for Excel:
https://learn.microsoft.com/de-de/power-platform/power-fx/reference/function-weeknum

Hint: If I use Mode 21 of "System 2" (ISO format), Excel and LibreOffice agree
in a test I did for years 2000-2026.

Steps to Reproduce:
1. In Calc, enter formula =WEEKNUM(DATE(2021;12;31);1)

Actual Results:
Calc outputs "1"

Expected Results:
Calc should output "53".
The function name is carried over from Excel, so the output should also be the
same for the sake of compatibility.


Reproducible: Always


User Profile Reset: No

Additional Info:
no

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to