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

            Bug ID: 172789
           Summary: DATEDIF treats the last days of some consecutive
                    months as 0 months apart
           Product: LibreOffice
           Version: 25.2.2.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 207721
  --> https://bugs.documentfoundation.org/attachment.cgi?id=207721&action=edit
test document

For example, `DATEDIF(DATE(2026,5,31),DATE(2026,6,30),"m")` gives `0`, but
those date are a whole month apart.

The Calc Functions documentation for DATEDIF[1] only says “Number of months
between the two dates” without specifying how different length months are
handled.  The ODF spec for DATEDIF[2] says “If there is not a complete month
between the dates, 0 will be returned” but does not specify how different
length months are handled or that the last day of a month does not complete a
month.

To match how people think about months, the last day of a month should be
treated as completing the month, and when there is a complete month between the
two dates 1 should be returned.

If the discrepancy is intentional, the spec and documentation should be revised
to make that clear


[1] https://wiki.documentfoundation.org/Documentation/Calc_Functions/DATEDIF
[2]
https://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#DATEDIF

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

Reply via email to