tc39 / proposal-intl-eradisplay

Intl.DateTimeFormat displays era field only if date displayed is in same era as today's
MIT License
11 stars 4 forks source link

What era to display for negative years in single-era calendars (Indian, Buddhist, Persian, Islamic) #5

Closed justingrant closed 3 years ago

justingrant commented 3 years ago

There are several calendars that currently display the same era for both positive and negative years. Is this expected? If not, then what should be the era name for negative years, or should it be blank?

Examples:

const calendars = ['indian', 'buddhist', 'persian', 'islamic'];
const dates = [new Date('-010000-01-01T00:00Z'), new Date('2020-01-01T00:00Z')];
for (const date of dates) {
  console.log(date.toISOString());
  for (const calendar of calendars) {
    console.log(`${calendar}: ${date.toLocaleDateString('en-US', {calendar, timeZone: 'UTC'})}`);
  }
}

/* output: 
-010000-01-01T00:00:00.000Z
indian: 6146/12/-10583 Saka (ignore known bug with month number)
buddhist: 3/18/-9457 BE
persian: 10/10/-10622 AP
islamic: -6/15/-10947 AH

2020-01-01T00:00:00.000Z
indian: 10/11/1941 Saka
buddhist: 1/1/2563 BE
persian: 10/11/1398 AP
islamic: 5/6/1441 AH
*/
Louis-Aime commented 3 years ago

There are several calendars that currently display the same era for both positive and negative years. Is this expected? If not, then what should be the era name for negative years, or should it be blank?

When the rules of a calendar authorises to display negative years, as it is for ISO 8601, the era stands more or less for epoch. This is really the case for the Indian calendar. I believe that the Persian, ethiopaa, islamic, and hebrew calendars are not expected to display dates before their respective origins: the ethiopic epoch Amete Alem means "creation of world", the hebrew era is "Anno Mundi", "year of the world", and I guess the choice to use negative years was a sort of default choice.

If you write "-752 common era", or any similar phrase in other languages, everyone understand you are 752 years before year 0 of common era. Whereas if you write "752" without sign, you have to tell that you are counting backwards. The minus sign is transferred into the expression of era.

Louis-Aime commented 3 years ago

Hence the idea that, for those calendar that display years with negative signs, like indian (and like iso8601 should do), displaying era is not useful, unless the users wants to. Today, the organisation of ICU / CLDR is such that the DateTimeFormat API displays the era part even if the user did not ask for it (except for gregory and iso8601). As mentionned, there is a proposal to solve this.

Louis-Aime commented 3 years ago

BTW, as already said, iso8601 should stick to the standard and should display negative years, not 1-y years. For gregory, as it is implemented as the proleptic Gregorian and not as the Julian, then Gregorian calendar with a fixed switching date, I would say the same in principle. However there is no real harm to keep it as today, with due explanations.

As of now, no Unicode calendar displays the historical dates of Europe before the Gregorian reform. But thanks to Temporal, this will change very soon.

sffc commented 3 years ago

I'm going to close this issue because it doesn't appear to be actionable.