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

            Bug ID: 168576
           Summary: weeknum does not match openformula specification on
                    days close to the end of the year
           Product: LibreOffice
           Version: 25.8.1.1 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
Weeknum is defined in the openformula standard as:
> Returns the number of the week in the year for the given date
Currently, libreoffice returns 1 for dates like 2025-12-31, which is wrong.
>From my testing it looks like libreoffice says that a week is a consecutive 7
days and week 1 is the week of the year which contains the first sunday (for
default) or X day of week for the "mode" version.

Maybe I am reading the standard wrong, but it seems to me that the (admittedly
vague) standard would require returning 53, since the last day of the year is
in the 53rd week of that year even if that week is a partial week. This matches
with what excel and sheets do. 

If I am reading the standard wrong, then at least the documentation should stop
saying "compatible with other spreadsheet programs" when it does not, and I
would advocate for a compatibility function like "WEEKNUM_EXCEL" to make
importing work correctly.

Steps to Reproduce:
Type =WEEKNUM(DATE(2025,12,31))

Actual Results:
1

Expected Results:
53


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 25.8.1.1 (X86_64)
Build ID: 54047653041915e595ad4e45cccea684809c77b5
CPU threads: 16; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster;
VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded

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

Reply via email to