Bug 144697 - Dates prior to the program's limit should display #FMT
Summary: Dates prior to the program's limit should display #FMT
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Eike Rathke
URL:
Whiteboard: target:7.3.0
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-24 07:30 UTC by Mike Kaganski
Modified: 2022-03-07 12:28 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2021-09-24 07:30:11 UTC
Put number -12661742 into A1, -12661743 into A2, -12662108 into A3.
Format all these as date (YYYY-MM-DD)

A1 displays reasonable '-32767-01-01'; A2 displays '--32768-12-31' (note two dashes, although the date itself *looks* reasonable); A3 (365 days before A2) displays unexpected '--32767-12-31' - see how the year changes in the wrong direction.

Obviously there was a numeric overflow when formatting the year.

Bug 129878 had introduced a dedicated "#FMT" indication for numbers not representable in the chosen formatting. This should be used for dates as well, which can't be displayed reasonably - like those outside of '-32767-01-01' (-12661742).
Comment 1 Xisco Faulí 2021-09-29 10:09:08 UTC
@Eike, I thought you might be interested in this issue
Comment 2 Commit Notification 2021-09-30 00:04:47 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ebc454ad4eb1f4cd4d84a7db367bb71a457c4e5c

Resolves: tdf#144697 Format out-of-bounds date(+time) as #FMT error

It will be available in 7.3.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.
Comment 3 Commit Notification 2021-09-30 14:29:45 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/fd1a63089332153e7180f16961d39c9c12654ff4

tdf#144697: svl_qa_cppunit: Add unittest

It will be available in 7.3.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.