Bug 144699 - Use proleptic Gregorian consistently for *all* date formatting and recognition
Summary: Use proleptic Gregorian consistently for *all* date formatting and recognition
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL: https://issues.oasis-open.org/browse/...
Whiteboard:
Keywords:
Depends on:
Blocks: Number-Format
  Show dependency treegraph
 
Reported: 2021-09-24 08:07 UTC by Mike Kaganski
Modified: 2024-11-01 21:29 UTC (History)
6 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 08:07:01 UTC
Bugs 96756, 144678, 144687, 144692 show some of the problems arising from our use of ICU's default Julian cutover date, which is 1582-10-15. There are more to it, e.g. there's no way to be ISO-8601-compatible using YYYY-MM-DD format, because ISO 8601 requires that all dates are sequential, while we have a sequence break around the cutover.

Note that the described problems are not limited to Calc; all modules use the same formatter to recognize and display dates.

It seems that it would be useful to not try to solve those bugs by making them honor Julian calendar (that would need additional complexity, and would not solve every problem); LibreOffice is not a tool that is intended to demonstrate *some* specific historical event when displaying dates (at least by default).

The proposal is to use proleptic Gregorian calendar for all the representable date range in LibreOffice; that would make all the mentioned problems to get resolved automatically, introducing consistency.

To not break existing documents, we likely need a new option (common to all ODF document types), like "Use proleptic Gregorian for all dates". It should be enabled by default in new documents, as well as in all imported documents (e.g., Excel does not format dates prior to 1900-01-01, so there may no compatibility issues with XLS(X) documents); but existing ODF documents, where there's no such flag defined, should be treated as before.

The option should *possibly* be located near current "Year (Two Digit)" configuration option on General page (however, the latter option is not document-specific, so my idea could be wrong; anyway, the location should be common/independent for all modules).
Comment 1 Mike Kaganski 2021-09-24 08:10:47 UTC
Or maybe it should not be an option specific to documents? It might be a program option, since it affects input handling (recognition) and output (formatting of the dates)? Provide it even as an expert option, since it would likely not affect a sizeable proportion of users, and make it on by default?
Comment 2 Mike Kaganski 2021-09-24 16:08:00 UTC
Damn. Reading ODF 1.4 part 3 sect. 19.341 number:calendar [1]:

> * gregorian: Gregorian calendar with cut-off date 1582-10-04, 1582-10-15
> following. Dates before cut-off date are calculated in Julian proleptic
> calendar [ISO8601], Section 2.4.1. 

It looks like my idea is a crap, and current calendar implementation follows the standard to the letter.

Then ODF 1.4 part 4 sect. 7.4 Year 1583 [2]:

> Evaluators may choose to support years even earlier than this; such
> evaluators should use a proleptic Gregorian system (continuing the years
> backwards as if the calendar existed in those years).

And here I fail to understand how to connect the two. So common calendar is defined to use Julian before cut-off; but Calc defines use of proleptic Gregorian (for formulas?).

[1] http://docs.oasis-open.org/office/OpenDocument/v1.3/OpenDocument-v1.3-part3-schema.html#a_19_341_number_calendar
[2] http://docs.oasis-open.org/office/OpenDocument/v1.3/OpenDocument-v1.3-part4-formula.html#a_7_4_Year_1583
Comment 3 Mike Kaganski 2021-09-24 16:26:14 UTC
(In reply to Mike Kaganski from comment #2)
> > * gregorian: Gregorian calendar with cut-off date 1582-10-04, 1582-10-15
> > following. Dates before cut-off date are calculated in Julian proleptic
> > calendar [ISO8601], Section 2.4.1. 

By the way: what the hell is "[ISO8601], Section 2.4.1"? The ODF standard refers to ISO 8601:2004; and in that standard, there were *no* section 2.4.1 (or 2.4, for that matter). It included three occurrences of "Julian":

> 2.2.15
> Gregorian calendar
> calendar in general use, introduced in 1582 to define a calendar year that
> more closely approximated the tropical year than the Julian calendar
> ...
> 3.2.1 The Gregorian calendar
> ...
> The introduction of the Gregorian calendar included the cancellation of the
> accumulated inaccuracies of the Julian calendar. However, no dates shall be
> inserted or deleted when determining dates in the proleptic Gregorian calendar.
> ...
> EXAMPLE The Gregorian calendar was introduced on 15 October 1582. In the
> calendar set by this standard the calendar day preceding that calendar day
> is referred to as 14 October 1582. In the Julian calendar that calendar
> day is referred to as 4 October 1582.

Is the reference to "Julian proleptic calendar" in ODF an error? Is the reference to the specific standard/pert of the standard an error?
Comment 5 Regina Henschel 2021-09-24 23:37:43 UTC
Wikipedia mentions "ISO 8601:2004 (clause 4.3.2.1 The Gregorian calendar)" in https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar
Comment 6 Mike Kaganski 2021-09-25 06:51:50 UTC
(In reply to Regina Henschel from comment #5)

Thanks Regina!
Yet, Wikipedia is obviously also misleading. It's a pity how such a fundamental international standard is not available to public, other than in previews like https://webstore.ansi.org/preview-pages/ISO/preview_ISO+8601-2004.pdf.

Section 4.3 in ISO 8601:2004 is "Date and time of day"; 4.3.2 is "Complete representations"; and there's no "4.3.2.1" there. And the section just discusses the representations like "YYYYMMDDThhmmss", "YYYY-Www-DThh:mm±hh" etc. with examples, and discusses the parts and their order for different types of dates like "calendar dates" and "week dates". No mention of Gregorian or Julian calendars there. (I can't share a link to a copy of the standard that I found with DuckDuckGo, somewhere at "http://dotat.at/").

Possibly the reference is valid in some different edition than 2004.
Comment 7 Mike Kaganski 2021-09-25 09:19:00 UTC
FTR: https://issues.oasis-open.org/browse/OFFICE-1680
Comment 8 Vollbracht 2021-09-26 13:41:01 UTC
ISO 6801 defines date conventions AFTER 1582 (and up to 9999) It explicitly excludes dates prior to 1583 unless otherwise agreed. Actually there is an agreement among astronomers to use Gregorian type dates prior to 1582 and even a year 0 and negative years. But this is no standard in general at all. All documents containing date values written in Occident between 1000 and 1500 use Julian calendar. Still some conversion functions - GREGORIAN(<Julian type date>), JULIAN(<Gregorian type date>) and ABURBE(<standard date after 755 B. C.>) might help. They would be great to help compare astronomical and historic data. ABURBE() would be very complex for date values prior to 709 a.u.c. / 45 B. C. due to 13 months scheme.
Comment 9 Mike Kaganski 2021-09-26 14:38:38 UTC
(In reply to Vollbracht from comment #8)
> ISO 6801 defines date conventions AFTER 1582 (and up to 9999) It explicitly
> excludes dates prior to 1583 unless otherwise agreed.

No, it does not exclude these dates - see the EXAMPLE cited from "3.2.1 The Gregorian calendar". It *only* requires the explicit agreement for using those - and this agreement is exactly what the standard should establish. And that is what has been asked on the OASIS mailing list.

> Actually there is an
> agreement among astronomers to use Gregorian type dates prior to 1582 and
> even a year 0 and negative years. But this is no standard in general at all.
> All documents containing date values written in Occident between 1000 and
> 1500 use Julian calendar.

This doesn't mean that we should use them.
Specifically, note that 1582 is *not* the time when "everyone" started to use Gregorian calendar. So that date has only *very limited* historical meaning related to "documents containing date values" - most of the world, even those its parts that use Gregorian today, kept using Julian (and some local deviations, like switching years at custom months) long after 1582; so when we use Gregorian for 17th, 18th, 19th centuries, we already break conventions used for most of the documents of that time.

Hence the use of Gregorian calendar does not aim to follow the historical facts, but is just a convention for use of uniform, contiguous date system.

Additionally, the reasoning concerning use of "proper calendar for the epoch" should then go beyond 45 BC - and not use proleptic Julian for those times, right? Otherwise it would be inconsistent.

But in any case, Gregorian calendar (as described by ODF, and as asked by *this* issue) should use proleptic Gregorian for all the range covered by dates representable in LO. Any "proper local calendars" should be used explicitly, and their introduction should be matter of separate issues.

> Still some conversion functions -
> GREGORIAN(<Julian type date>), JULIAN(<Gregorian type date>) and
> ABURBE(<standard date after 755 B. C.>) might help. They would be great to
> help compare astronomical and historic data. ABURBE() would be very complex
> for date values prior to 709 a.u.c. / 45 B. C. due to 13 months scheme.

These are outside of the scope of this request.