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

            Bug ID: 145578
           Summary: The WEEKS() function gives an incorrect answer around
                    January 4th
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
The WEEKS function appears to be giving an incorrect answer when calculating a
calendar week difference before January 4th of a year.

I've tried to work through the calculation as given in the source code
separately, and when I did this I got the correct answer, so I'm not sure where
the issue could be coming from.

Steps to Reproduce:
1. Put "=WEEKS("2022-01-09","2022-01-10",1)" in a cell
2. Put "=WEEKS("2022-01-02","2022-01-03",1)" in a second cell

I found another set of dates that illustrate the problem too:
"=WEEKS("2017-01-08","2017-01-09",1)"
"=WEEKS("2017-01-01","2017-01-02",1)"

Actual Results:
The first cell shows 1, the second one shows 0.

Expected Results:
Both cells should have shown 1.


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
The operation of the function is described in the source file, which I read at
this link:
https://github.com/LibreOffice/core/blob/14cfff500e93f0d6cbf8412065feea85c01ea81d/scaddins/source/datefunc/datefunc.cxx#L442

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

Reply via email to