Skip to content

Which Hijri calendars should Temporal support? #29

@sffc

Description

@sffc

There are several ongoing discussions on related topics, including unicode-org/icu4x#6330, unicode-org/icu4x#6210, tc39/ecma402#971, and others. For this issue, I wanted to focus on Temporal and the problems unique to Temporal.

Say I want to encode "the date of Eid al-Fitr in 1446 AH". I might write

Temporal.PlainDate.from({ calendar: "islamic-tbla", year: 1446, month: 10, day: 1 })

This gets encoded in the data model as: 2025-03-30[u-ca=islamic-tbla]

This is fine, except that it requires one of the invariants that we've previously described as being paramount to our data model: roundtripability with ISO. Looking at all the Hijri variants:

  • islamic-tbla and islamic-civil retain this invariant since they are backed by a rule-based algorithm.
  • islamic-umalqura retains this invariant for current and historical dates. However, if Saudi Arabia publishes a new almanac for Umm al-Qura, ICU will adopt it, meaning that it's possible that the roundtripability could change for future dates.
  • islamic (which in ICU is the same as islamic-rgsa) is currently backed by an astronomic simulation that does not match ground truth in any known country. The definition of islamic-rgsa is that it should match the "Saudi Arabia sighting", which, like Umm al-Qura, implies that the underlying code might change over time. However, this might also change for dates in the past, since tweaking the simulation algorithm could impact dates across a wider range.

So overall, I think it's safest to stick with islamic-tbla, islamic-civil, and islamic-umalqura in Temporal (and acknowledge the caveat with Umm al-Qura). Although my motivation is different, this aligns with @dminor's proposal in tc39/ecma402#971 to consider unshipping islamic and islamic-rgsa from Intl.DateTimeFormat.

Just to be clear to onlookers: Temporal retains full support for Hijri with this proposal, including formatting and arithmetic.* The only difference is in conversion to ISO and Gregorian; since we can't predict that conversion into the future with an observation-based calendar, we only support the algorithmic versions. However, one can still write their own function that uses observation data to augment the conversion to Gregorian in user land. * Caveat: it may not be possible to represent the 30th day in a particular month if the rule-based islamic calendar does not give that month 30 days. We could consider something that can represent all possible dates if proposed, perhaps naming it islamic-thirty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agendaNeeds confirmation from the champion group meeting

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions