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

            Bug ID: 162598
           Summary: Calc: WEEKNUM returns wrong result for last week of
                    December if January 1st (next year) is not a Sunday.
           Product: LibreOffice
           Version: 24.8.0.3 release
          Hardware: All
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
The function WEEKNUM is not returning the correct result for the last days of
the year when January 1st (of next year) is not a Sunday.

If December 31st is not a Saturday, WEEKNUM(YEAR, 12, 31) returns "1".

This affects other days of the last week of December. For example, for
WEEKNUM(YEAR, 12, 29) to return the correct result, the 29th has to be a
Thursday, a Friday or a Saturday, independently of the day of the 31st.

Steps to Reproduce:
1. On a row input the years 2015 through 2023
2. Next row: DATE(cell above, 12, 31) for each column
3. Next row: WEEKDAY(cell above) for each column
4. Next row: WEEKNUM(reference DATE row) for each column

Actual Results:
2023        2022        2021        2020        2019        2018        2017   
    2016        2015
12/31/23        12/31/22        12/31/21        12/31/20        12/31/19       
12/31/18        12/31/17        12/31/16        12/31/15
1           7           6           5           3           2           1      
    7           5
1           53          1           1           1           1           1      
    53          1

Expected Results:
2023            2022            2021            2020            2019           
2018            2017            2016            2015
12/31/2023      12/31/2022      12/31/2021      12/31/2020      12/31/2019     
12/31/2018      12/31/2017      12/31/2016      12/31/2015
1                       7                       6                       5      
                3                       2                       1              
        7                       5
53                      53                      53                      53     
                53                      53                      53             
        53                      53


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.8.0.3 (X86_64) / LibreOffice Community
Build ID: 0bdf1299c94fe897b119f97f3c613e9dca6be583
CPU threads: 16; OS: Linux 6.9; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Flatpak
Calc: threaded

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

Reply via email to