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

Consider unshipping islamic and islamic-rgsa calendars #971

Open
dminor opened this issue Mar 3, 2025 · 9 comments
Open

Consider unshipping islamic and islamic-rgsa calendars #971

dminor opened this issue Mar 3, 2025 · 9 comments

Comments

@dminor
Copy link

dminor commented Mar 3, 2025

Although the list of calendars is implementation defined, historically implementers have shipped what is supported by ICU4C / CLDR. While investigating differences between ICU4C and ICU4X, we've come across some questions about the value of shipping the islamic and islamic-rgsa calendars to the web.

In particular, the islamic uses an astronomical calculation that requires an observation point to be specified, but there's no ECMA-402 API to specify that location. More research is needed, but this would suggest that the result of using this calendar is not well-defined.

The islamic-rgsa calendar is not implemented in either ICU4C or ICU4X. It is observational based, impossible to predict in the future, and would require lookup tables to implement for the past.

Although support is implementation defined, we do have at least some test cases that assume the presence of these calendars in implementations.

Although what calendars are shipped is implementation defined, having agreement between implementations on the value of these calendars would be beneficial for the web. One possible result here would be a note saying these calendars are not recommended for use on the web.

@justingrant
Copy link
Contributor

FYI @dminor - I edited your OP to correct islamic-rgba to the correct spelling.

@sffc sffc moved this to Priority Issues in ECMA-402 Meeting Topics Mar 3, 2025
@hsivonen
Copy link
Member

hsivonen commented Mar 4, 2025

In particular, the islamic uses an astronomical calculation that requires an observation point to be specified, but there's no ECMA-402 API to specify that location.

I think "API to specify that location" is getting way ahead of things. It would be good to understand what use case this kind of simulation that's neither actual sighting nor a specific known-outside-software Hijri calendar variant could address to user satisfaction.

@dminor
Copy link
Author

dminor commented Mar 4, 2025

I agree, I'm not suggesting that we need to add such an API, it's that what we have now probably isn't useful without one.

@Manishearth
Copy link

It would be good to understand what use case this kind of simulation that's neither actual sighting nor a specific known-outside-software Hijri calendar variant could address to user satisfaction.

100% this.

Almost nobody follows an observational calendar based on their current location. Rather, it is based on a location chosen by your sect/subsect/country. If we wanted to make this configurable, this should be some choice from an enum, not configurable.

The question is: is the astronomical point used by ICU4C (and ICU4X) one that is meaningfully used by many people? If so, can islamic be explicitly defined as that one?

@sffc
Copy link
Contributor

sffc commented Mar 5, 2025

@younies told me: "In countries with established local calendars, like Egypt, people tend to use those. Conversely, in countries without such calendars, such as Norway, the observational calendar from Saudi Arabia is commonly followed."

@Manishearth
Copy link

Manishearth commented Mar 5, 2025

So some background on the types of calendar here:

Tabular calendars follow a simplified mathematical set of rules, typically some form of Metonic cycle.

Astronomical calendars (like Umm al-Qura) follow moon math based on a particular fixed observational point.

Observational calendars have observations as their source of truth: some religious or government official is in charge of looking at the moon and reporting whether it is seen. This may or may not be affected by cloud cover. In Egypt, apparently they use a helicopter to avoid this problem, however even then the observations may disagree from astronomical calculations: the ultimate source of truth is the observation.

Implementation-wise, parametrizing these is potentially useful, but from a user POV what you want is actual calendars used by groups of people, whether they be civil calendars or commonly-followed religious calendars. And you want the calendars to be accurate.

So we may end up having multiple astronomical calendars, parametrized internally by observation location or thursday-vs-friday epoch, but having different names externally. We may also have multiple observational calendars, parametrized internally and externally by observing body.

We should probably focus on observational calendars that can actually be predicted: if a calendar has a 99% chance of being properly predicted by astronomical calculations, that seems fine, but if a calendar is affected by cloud cover it is probably not good to include.

(In theory, with frequently-updated data, ICU4X could support purely observational calendars that include cloud cover. We don't right now, and neither does ICU4C.)

@justingrant
Copy link
Contributor

The question is: is the astronomical point used by ICU4C (and ICU4X) one that is meaningfully used by many people? If so, can islamic be explicitly defined as that one?

👍 If this can be solved via documentation, that sounds like a much better outcome than removing calendars because many apps likely use a calendar without knowing (or perhaps caring?) that the results are not always accurate. Breaking those would be bad.

Also, once there's a resolution here, I should update my answer to this Stack Overflow question: https://stackoverflow.com/questions/70996839/discrepancy-in-javascript-intl-datetimeformat-outputs-for-the-islamic-hijri

@sffc
Copy link
Contributor

sffc commented Mar 6, 2025

Needs more research, but a potential solution could be:

  1. Define in CLDR the Islamic observational calendars that in modern times are reliably approximated by astronomical calculations (not adversely impacted by uncertainties such as cloud cover). It seems that the Egyptian and Saudi observations adhere to this, so we might get islamic-rgsa and islamic-rgeg, for example.
  2. If the specified calendar is islamic, we use the region subtag (or -u-rg or -u-sd) to check if we have a calendar with that same observation point. If we do, we use it. Otherwise, we fall back to an implementation-defined default, which will probably be islamic-rgsa.

For example:

Locale Resolved Calendar Explanation
und-u-ca-islamic-rgsa islamic-rgsa Explicit calendar variant
und-EG-u-ca-islamic islamic-rgeg Infer variant from region subtag
und-SA-u-ca-islamic-rg-egzzzz islamic-rgeg Infer variant from region extension
und-u-ca-islamic islamic-rgsa Use the Saudi Arabia observation as the default

@sffc
Copy link
Contributor

sffc commented Mar 6, 2025

Another thought, which should be discussed with CLDR, is whether the formatting of the calendars should also specify the observation point for additional clarity. For example, instead of saying "1446 AH", maybe it should say "1446 AH (Egypt)". Likewise, islamic-tbla could render as "1446 AH (Tabular)" or something. Whether or not the "(Egypt)" or "(Tabular)" is displayed can be controlled by e.g. the Era Display proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Priority Issues
Development

No branches or pull requests

5 participants