Bug 164124 - Mismatching partial date input in date pre-formatted cell may lead to fraction being recognized
Summary: Mismatching partial date input in date pre-formatted cell may lead to fractio...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.3 all versions
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:25.8.0 target:25.2.0.0.beta2 t...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-02 09:14 UTC by gplhust955
Modified: 2024-12-17 14:29 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 gplhust955 2024-12-02 09:14:52 UTC
Description:
I encountered an issue where entering ‘2021-6/1’ produces different results based on the cell’s format: 
if the format is ‘YYYY-MM-DD’, it is interpreted as a date; 
otherwise, for formats like ‘MMM DD,’ it is treated as text.

Steps to Reproduce:
1. Set the cell format as YYYY-MM-DD, enter string "2021-6/1"
2. Set the cell format as MMM-DD, enter string "2021-6/1"

Actual Results:
I believe the underlying interpretation rules should be independent of the cell format.

Expected Results:
1. date 1905-07-19
2. text 2021-6/1


Reproducible: Always


User Profile Reset: No

Additional Info:
I believe the entered string ‘2021-6/1’ should be interpreted as text, regardless of the cell format.
Comment 1 viktoriia.strekalovskaia 2024-12-03 21:34:25 UTC
Thank you for reporting the bug.

 I can confirm that for both formats YYYY-MM-DD and  MM-DD  string   ‘2021-6/1’ turns into a dates 1905-07-19 and 07-19. But it doesn't turn into a date if you put dash instead of hyphen.


Version: 24.8.3.2 (AARCH64) / LibreOffice Community
Build ID: 48a6bac9e7e268aeb4c3483fcf825c94556d9f92
CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx

Version: 25.2.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: 7713d916e06a8388f849a758f928cbcfded6c0ae
CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx
Comment 2 Buovjaga 2024-12-04 16:07:19 UTC
Checked in the dev chat and it is "implemented specifically for dates/times", so let's close.
Comment 3 Eike Rathke 2024-12-04 17:49:17 UTC
Note this depends on the locale, e.g. is not reproducible in an en-CA locale with Y-M-D date acceptance pattern, but is in en-US (M/D/Y) or en-GB (D/M/Y) or de-DE (D.M.Y).

However, I don't see a reason why an input of 2021-6/1 should result in a date of 1905-07-19, this looks plain wrong to me.
Comment 4 Eike Rathke 2024-12-05 17:24:37 UTC
The input erroneously hits the fraction detection and ends up as 2021 6/1 = 2027, and 2027 days since the null date 1899-12-30 gives 1905-07-19.
This at least since LO 5.3, probably earlier, don't have an older version at hand.
Comment 5 Commit Notification 2024-12-06 01:05:01 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6926c820ceea1a1337a97b0afda95b072027a6ff

Resolves: tdf#164124 Do not trap incomplete date 2021-6/1 as fraction

It will be available in 25.8.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 6 Commit Notification 2024-12-06 01:58:08 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/5ddccd3896abe24de2ff4b4f3cc9bf609305990a

Resolves: tdf#164124 Do not trap incomplete date 2021-6/1 as fraction

It will be available in 25.2.0.0.beta2.

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 7 Eike Rathke 2024-12-06 11:07:12 UTC
Pending review https://gerrit.libreoffice.org/c/core/+/177959 for 24-8.
Comment 8 Commit Notification 2024-12-06 16:21:05 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

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

Resolves: tdf#164124 Do not trap incomplete date 2021-6/1 as fraction

It will be available in 24.8.5.

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 9 Commit Notification 2024-12-10 10:23:56 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-24-8-4":

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

Resolves: tdf#164124 Do not trap incomplete date 2021-6/1 as fraction

It will be available in 24.8.4.

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 10 Commit Notification 2024-12-17 14:29:32 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

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

tdf#164124: sc_ucalc: Add unittest

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