Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structure of era: should era field be an integer number ? #968

Closed
Louis-Aime opened this issue Oct 7, 2020 · 4 comments
Closed

Structure of era: should era field be an integer number ? #968

Louis-Aime opened this issue Oct 7, 2020 · 4 comments

Comments

@Louis-Aime
Copy link

The concept of era is only needed for those calendars in which there is a discontinuity in the representation of any kind.
The ISO8601 is designed for having no discontinuity. Always the same reckoning, only one years scale. Hence, there is no need for eras.
Many other calendars have discontinuities at different instants. You designate "eras" the successive periods. The eras are designated with names ("Reiwa", "Common era", "Anno Mundi"., "Saka"), or acronyms ("C.E." or "CE", "A.M."). The names are translated in the different languages. This is similar to months and weekdays.
But for all calendars, the eras may be ordered, starting with the one used for the most ancient dates.
E.g. : "Taika" for japanese, Amete Alem for ethiopic, "B.C." or "B.C.E." for the julian calendar used for historical dates.

My suggestion is that the era optional property of the Temporal objects should be an positive integer number, starting from 0.

The question of representing the era with some text should be addressed in the same way as for months and weekdays. In Temporal, those are numbers.

Calendars may have no era, like iso8601. era field is undefined.
They may have only one era, which is 0. So are: buddhist, ethioaa, hebraic, indian, the five islamic, persian.
Some of them have a first era that counts years backwards from 1: coptic, gregory, roc.
I do not put chinese nor dangi in those categories. IMHO, those calendars have no era, but they count years by 60, it is more a question of numbering system for the years.

This proposal summarizes comments on #526, #675, #750 (era is deemed as necessary as year, month, day), #889, #901, #902.

@Louis-Aime
Copy link
Author

With this concept, it is possible to construct custom calendars for each each location in Europe. Take France:
era 0 : "avant Jésus-Christ", before 0000-12-30, Julian calendar reckoning, years counted backwards from 1.
era 1 : "après Jésus-Christ", from 0000-12-30, Julian calendar reckoning, years counted forwards.
era 2: "ancien style", from 1582-10-15, Julian calendar reckoning, Gregorian transition not yet applied
era 3: "nouveau style", from 1582-12-20, ISO8601 calendar reckoning.
era 4: "ère des Français", from 1793-10-6, French republican calendar reckoning.
era 5: "après Jésus-Christ", from 1806-01-01, ISO8601 calendar reckoning.

Using Intl.DateTimeFormat and "custom locale data register", you could represent all months, weekdays (even Primidi etc.) and eras.

@ptomato
Copy link
Collaborator

ptomato commented Oct 7, 2020

I agree with all this, but on the other hand, as mentioned in #526 it's an extremely bad experience for API users:

Temporal.Date.from({
  calendar: 'japanese',
  era: 181,  // ???
  year: 2,
  month: 10,
  day: 7
})

@Louis-Aime Louis-Aime changed the title Optional era field should be an integer number Structure of era: should era field be an integer number ? Oct 11, 2020
@Louis-Aime
Copy link
Author

I changed the title of this proposal after @ptomato's comment. I think we all agree that the eras of a calendar are an ordered series of named periods. In principle, this concept could be implemented as an integer value. After all, the series of months is also a series of named periods, and we represent month with an integer number. However, doing so for era could be as complicated as representing a Date with a single number, e.g. the integer Julian day number.
Could we agree that the series of eras of any calendar should be represented by an array of codes, in the order of the eras' occurrences. Each code would be a small string (trigram?) of ASCII characters, unique for each series. A better experience for API users, a solid-state solution for Temporal.Calendar.
Intl.DateTimeFormat would use the code for selecting the string to be displayed, following Locale and options.

@ptomato
Copy link
Collaborator

ptomato commented Jan 14, 2021

I think this can be folded into #526.

@ptomato ptomato closed this as completed Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants