Bug 164170 - TAG(<date value>) / DAY(<date value>) give wrong results for pre-1582-10-15 dates
Summary: TAG(<date value>) / DAY(<date value>) give wrong results for pre-1582-10-15 d...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: QA:needsComment
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-04 19:15 UTC by Vollbracht
Modified: 2024-12-19 03:14 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
file showing bug (37.84 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-12-04 19:18 UTC, Vollbracht
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vollbracht 2024-12-04 19:15:28 UTC
Description:
Every pre 1582-10-15 date inserted in Calc is a Julian date. Calculations on dates such as subtraction of any number of days from any date work correctly with respect on enactment of Gregorian calendar in the night from 4th to 15th of October 1582. The DAY() / TAG() function however takes the date value (integer) of any date and recalculates the Gregorian day of month based on its own algorithm ignoring the Julian cut-over. Remember: 1582-10-4 (jul) is followed by 1582-10-15 (greg). As a result =DAY(<field>) with <field> having 1582-10-4 entered shows 14 instead of 4 e.g..

Steps to Reproduce:
1.Have 1582-10-15 in field a1 and 1499-10-04 in field a3.
2.Have =A1-1 in field a2.
3.Have =DAY(A1) in field b1, =DAY(A2) in field b2 and =DAY(A3) in field b3.

Actual Results:
The correct Julian date 1582-10-04 is shown in field a2 just as 1499-10-04 (jul) in field a3 as expected, but field b2 shows 14 and field b3 shows 13.

Expected Results:
Fields b2 and b3 should show 4.


Reproducible: Always


User Profile Reset: No

Additional Info:
work around: transform to text, parse and retransform to number.
happens in 24.8.1.2 (installed German -> TAG() function) and LibreOffice-still.basic-x86_64.AppImage as of 2024-12-04 and probably in all previous versions.

See bug 144699 discussion as well. We need consistent usage of date formatting and calculation. Historians use Julian dates for all time prior to cut over date. All documents containing date values written in Occident between 1000 and 1500 use Julian calendar. Usage of proleptic Gregorian dates needs agreement, was agreed in astronomy but now even in NASA documents I found Julian dates without special declaration.
Comment 1 Vollbracht 2024-12-04 19:18:33 UTC
Created attachment 197941 [details]
file showing bug