Created attachment 190227 [details] DAY(ISO String) for date before epoche date Open attached file. The result for DAY("1899-12-29T15:26:14") should be 29 but is 30.
The date was correct in LibreOffice 3.5.4.2 Build ID: 165a79a-7059095-e13bb37-fef39a4-9503d18 The date is wrong in Version: 4.4.7.2 Build ID: f3153a8b245191196a4b6b9abd1d0da16eead600 Locale: en_US
Reproducible: Looks as the time part was rounding up. And only fails for: 1899-12-29 Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 9eb419b0b0f019f5fbc48ff1a11977e8b041edee CPU threads: 16; OS: Windows 10.0 Build 22621; UI render: Skia/Vulkan; VCL: win Locale: es-ES (es_ES); UI: en-US Calc: CL threaded
@Eike, I thought you might be interested in this issue
Same for =MONTH("1899-11-30T00:00:01") results in 12 instead of 11. For 1898-12-31T00:00:01 it's day=1, month=1, year=1899. (In reply to m.a.riosv from comment #2) > Looks as the time part was rounding up. And only fails for: > 1899-12-29 No, it fails for all dates before the null-date.
This is also independent of whether the argument is a string or a date+time value.
Eike Rathke committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/2fa1cdcaeff7d1583aedfcee5b7c802e951b3a86 Resolves: tdf#157786 Use GetFloor32() for date days instead of GetInt32() It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Pending review https://gerrit.libreoffice.org/c/core/+/158039 for 7-6
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/07a80b8940a16ba1b7fd047865179809bd74a563 tdf#157786: sc_datetime_functions: Add unittest It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-7-6": https://git.libreoffice.org/core/commit/030c77d3e048a5235691db316e614ce3335037fe Resolves: tdf#157786 Use GetFloor32() for date days instead of GetInt32() It will be available in 7.6.3. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Regression. Confirmed again in Mac Version 7.5. =DAY(1590-01-06 05:22:00) expected: 6 actual: 7 =DAY(1990-01-06 05:22:00) expected: 6 actual: 6 =YEAR() and =MONTH() appear to work correctly but =DAY() adds an extra day in years before 1900.
*** Bug 157974 has been marked as a duplicate of this bug. ***