Skip to content

Conversation

@hsivonen
Copy link
Member

Publicly-available information about how the islamic-rgsa identifier was minted for JDK purposes, how JDK acknowledges past-sighting-data-only calendar possibility, the context of minting the identifier together with islamic-umalqura (an SA simulation), and the CLDR display name for islamic-rgsa all indicate that islamic-rgsa is supposed to denote sighting
data (that can be past only), so we shouldn't be saying that a simulation corresponds to it.

@hsivonen hsivonen requested review from robertbastian and removed request for Manishearth and sffc December 12, 2025 08:02
Copy link
Member

@robertbastian robertbastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't remove the docs if we still have the logic

Hijri(Some(HijriCalendarAlgorithm::Rgsa)) => Ok(AnyCalendarKind::HijriSimulatedMecca),

@hsivonen
Copy link
Member Author

How can we best go from what API surface we have shipped to acknowledging that islamic-rgsa is not implemented by ICU4X (or other software that we know about for that matter) with the semantics that it evidently was intended to have?

On the Web Platform side, the result of the December 2025 TG2 meeting was to treat -u-ca-islamic-rgsa as unknown, i.e. the same observable behavior as -u-ca-unassign or any other not defined identifier.

Can we deprecate our Rgsa enum variant and then treat islamic-rgsa as unknown in

? CC @zbraniecki

(I'm pretty sure that I have tried to make the point about the history and implementation situation of islamic-rgsa in our meetings before that mapping code landed. It's unfortunate that we still ended up shipping the mapping code, whose existence is now news to me.)

@robertbastian
Copy link
Member

The CalendarAlgorithm type covers everything that CLDR defines, which includes rgsa. I don't see this as an issue, this code could be used by clients that actually want to do something with rgsa.

What we should remove/deprecate is the AstronomicalSimulation type and the HijriSimulated AnyCalendar and AnyCalendarKind variants. The conversion from CalendarAlgorithm to AnyCalendarKind can return None for rgsa.

@hsivonen
Copy link
Member Author

hsivonen commented Dec 12, 2025

CC @sffc and @Manishearth to agree on the approach before writing a more complex PR.

@Manishearth
Copy link
Member

I think we should have further discussion about the desired end state first.

Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR removes a factual statement. If the user provides "islamic-rgsa" as their locale calendar, ICU4X returns the HijriSimulatedMecca calendar. We can discuss separately how we want to behave here, which involves agreeing on what we want the end state to be, but let's not delete valid documentation for what is the current status quo.

@hsivonen
Copy link
Member Author

This PR removes a factual statement.

The statement is a statement about CLDR correspondence, and (I believe) the claim of CLDR correspondence is incorrect.

We can discuss separately how we want to behave here, which involves agreeing on what we want the end state to be

When I added CCs, I meant to have that conversation.

Do we agree that the following statements are true?

  • islamic-rgsa is intended to denote actual past sighting data, since 1) it was requested by Oracle and their docs say about possible, but not included in OpenJDK, HijrahChronology subclasses "For sighting based calendars only historical data from past sightings is available.", 2) it was minted in the same CLDR release as islamic-umalqura, so it is clearly in contrast to a Saudi Arabia astronomical simulation, and 3) the CLDR display name says "sighting".
  • OpenJDK ended up not shipping islamic-rgsa.
  • CLDR, ICU4X, ICU4C, ICU4J, and OpenJDK don't carry past sighting data.
  • The 2025-12 TG2 meeting decided to require islamic-rgsa be treated as an unknown identifier for ECMA-402 purposes.
  • In the presence of an official Mecca-reference astronomical simulation (Umm al-Qura), there is not attested user demand for an unofficial (Reingold) Mecca-reference astronomical simulation.

If we can agree that the above statement are true, can we agree on the following conclusions?

  • ICU4X does not implement a calendar with the intended semantics of islamic-rgsa, so ICU4X should not give the appearance that it does.
  • ICU4X does not have a use case-driven need to provide a mapping from a keyword to Mecca-reference Reingold simulation.

@Manishearth
Copy link
Member

I think the core disagreement between people here and your points is whether islamic-rgsa really had intended semantics at all: it clearly did at one point, but that's not what shipped, so at this point it's just ... whatever.

I wanted this documentation because as our enums have, over time, diverged from the BCP47/CLDR names, and this makes things quite confusing when debugging.

@hsivonen
Copy link
Member Author

at this point it's just ... whatever

As I said in last week's meeting, I think it's bad for a library that is positioned and regarded as embodying i18n expertise to have things whose status is "whatever" but it's not apparent to the library user.

@sffc
Copy link
Member

sffc commented Dec 16, 2025

Do we agree that the following statements are true?

  • islamic-rgsa is intended to denote actual past sighting data, since 1) it was requested by Oracle and their docs say about possible, but not included in OpenJDK, HijrahChronology subclasses "For sighting based calendars only historical data from past sightings is available.", 2) it was minted in the same CLDR release as islamic-umalqura, so it is clearly in contrast to a Saudi Arabia astronomical simulation, and 3) the CLDR display name says "sighting".

I consider https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types to be the source of truth for the CLDR calendar definitions. It defines islamic-rgsa as the (religious) Hijri calendar based on a Saudi Arabia sighting. It seems that ICU landed it based on Reingold because it was closer to being "sighting-based" than the Umm al-Qura data.

The Reingold simulations are, I believe, close enough to the real sightings that it's possible to encode sighting data with an adjustment of exactly 0 or 1 days, whereas Tabular Islamic seems to require -2, -1, 0, 1, or 2 days.

The above document was apparently published in 2013, which is not really all that long ago. We should be able to find the people involved in that decision.

@robertbastian
Copy link
Member

It seems that ICU landed it based on Reingold because it was closer to being "sighting-based" than the Umm al-Qura data.

Where does it say that?

The Reingold simulations are, I believe, close enough to the real sightings that it's possible to encode sighting data with an adjustment of exactly 0 or 1 days, whereas Tabular Islamic seems to require -2, -1, 0, 1, or 2 days.

How many days does UAQ need?

@sffc
Copy link
Member

sffc commented Dec 16, 2025

The ICU-TC has long considered, and still considers, Reingold to be the gold standard for astronomical simulations. So, if the goal is to match the moment when a new moon actually occurs, then Reingold should be the basis over any of the other algorithmic approaches.

Umm al-Qura involves a proprietary/heuristic "Saudi criterion". In practice, Umm al-Qura is usually ahead of the human observation, but it could be behind.

I'll try to explain my understanding in a table:

Method Sighted crescent relative to the true new moon Possible day offset from human observation
Human Observation Usually several hours after. Never before. 0 (identity)
Umm al-Qura Usually several hours after. The criterion has changed multiple times. It looks at things like the angle of the moon relative to the sun, etc. As a result, the Umm al-Qura sighting might not align with the human sighting. -1, 0, 1
Reingold Very near, perhaps a few minutes before or after 0, 1
Tabular Could be many hours before or after -2 (?), -1, 0, 1, 2

Let me explain the third column a bit more. Suppose Tabular says that Ramadan starts on Wednesday. Your sighting-adjustment code needs to be prepared to adjust it to Monday (if the table is really late with its crescent), Tuesday, Wednesday, Thursday, or Friday (if the table is really early with its crescent). If Reingold says that Ramadan starts on Wednesday, though, then Ramadan will either start on Wednesday or Thursday (if there was cloud cover or the crescent wasn't visible before sunset, etc). I think but am not certain that Ramadan wouldn't be starting on a Friday. If Umm al-Qura says it starts on Wednesday, then the result is probably also Wednesday or Thursday, but it's possible depending on the version of Umm al-Qura being used that it could be late and Ramadan actually started on Tuesday.

This post is based on my understanding of the situation and could change based on additional facts/data.

@hsivonen
Copy link
Member Author

The ICU-TC has long considered, and still considers, Reingold to be the gold standard for astronomical simulations. So, if the goal is to match the moment when a new moon actually occurs, then Reingold should be the basis over any of the other algorithmic approaches.

Is there any attested use case indicating that users need an unofficial approximation that's expected to yield results somewhere between the two Saudi Arabia-based authoritative sources (KACST's simulation, which we do have the data for for a date range, and sighting, which we don't have the data for and cannot have future data for)?

Oracle requested an identifier with semantics that we don't have the data for and OpenJDK didn't end up shipping it. ICU4X shouldn't do something approximal in order to have some behavior for all the minted identifiers. ICU4X should be able to conclude that ICU4X doesn't have an implementation for what the identifier is meant for.

@Manishearth
Copy link
Member

Discussion about future of this calendar:

  • Manish: I don't think we would land this calendar as-is today.
  • Shane: I think it is a good calendar
  • Robert: It might be, it's in the same state as Korean a year ago.
  • Shane: I think it's a calendar that has use cases. I don't think it's a good enough calendar that it should be in the default ecmascript set. But I think it's useful as a basis for other things.
  • Manish: Fine with that. Though one of the routes for fixing AnyCalendar to be GoodCalendar is to make this type a deprecated alias and add a proper not-used-in-AC copy of it
  • Robert: My thinking is that Temporal should use what we call FormattableAnyCalendar which is currently private
  • Shane: We put AC on the DT API because we didn't want to export FAC, and I did a bunch of work to hide FAC and expose AC, but it has all these fallible variants.
  • Robert: Could have done it without exporting any of these types.
  • Shane: We eneded a RefCalendar because of ConvertCalendar. And you can't export a Ref<impl Calendar>
  • Robert: IF you want ConvertCalendar to be implementable, yes.
  • Shane: for jiff/etc
  • Robert: You only need this for format_same_calendar
  • (...)
  • Robert: Temporal can't use AC constructors
  • (...)
  • Manish: overall I don't think anyone thinks that if this calendar were to land today it would make its way into AC

@sffc
Copy link
Member

sffc commented Dec 16, 2025

Additional background: https://unicode-org.atlassian.net/browse/CLDR-5525

I talked with @macchiati who said:

  • CLDR wrote the definitions for these Islamic variant subtags, but deferred to ICU on the implementation.
  • The sighting adjustment is never more than 3 days, even if the moon isn't visible.
  • Old Apple systems did ship up-to-date sighting data. It's unclear if they still do.

@sffc
Copy link
Member

sffc commented Dec 16, 2025

My personal position:

  1. HijriSimulated is useful as a basis on top of which sighting adjustments can be made. See Avoid claiming that HijriSimulated corresponds to islamic-rgsa #7311 (comment)
  2. HijriSimulated is useful in order to give clients something to reach for if they need to align with ICU4C behavior.
  3. Because of (1) and (2), there is sufficient motivation for icu_calendar to ship this calendar.
  4. Since islamic-rgsa has mapped to this calendar for 12 years in ICU4C, and since I believe ICU4X should ship the calendar, I believe that ICU4X islamic-rgsa should continue to map to HijriSimulated.
  5. None of this implies that HijriSimulated should be included in a GoodCalendar enum or be exposed in ECMAScript.

@Manishearth
Copy link
Member

Manishearth commented Dec 16, 2025

HijriSimulated is useful in order to give clients something to reach for if they need to align with ICU4C behavior.
...
Since islamic-rgsa has mapped to this calendar for 12 years in ICU4C, and since I believe ICU4X should ship the calendar, I believe that ICU4X islamic-rgsa should continue to map to HijriSimulated.

I don't think it's accurate to say islamic-rgsa has mapped to this calendar for 12 years in ICU4C. ICU4C's impl is just a big TODO, redirecting to IslamicCalendar, which is a tabular calendar (islamic-civil, I think, but I'm not sure).

This makes these goals incompatible as stated, since ICU4X's HijriSimulated does not match what ICU4C does.

If we want ICU4C compat, we should ship this as Tabular. islamic-rgsa has mapped to a tabular calendar for 12 years .

HijriSimulated is useful as a basis on top of which sighting adjustments can be made. See #7311 (comment)

This is reasonable, but we should document this as not matching any ground truth and instead being a source for adjustments.

None of this implies that HijriSimulated should be included in a GoodCalendar enum or be exposed in ECMAScript.

Thanks for clarifying. My own position is that it should not be in AnyCalendar (regardless of what AnyCalendar ends up being).


@sffc Most of your arguments are about why we ought to have such a type. Most of my concerns are about it showing up in AnyCalendar<, and given that rgsa maps to Tabular in ICU4C, how does this sound as a solution:
  • Map islamic-rgsa in AnyCalendarKind to a tabular calendar, to match ICU4C behavior.
    • This way, assuming ICU4C eventually fixes Chinese/Dangi, we will be 100% compat with how ICU4C handles these things!
  • The current AstronomicalSimulation type is deprecated and given Tabular-like behavior.
  • All AnyCalendar variants are deprecated
  • We introduce a new AstronomicalSimulation-like type with the current behavior. I can't think of a good name, unfortunately.

This means we can continue to have a type for this with the utility you propose, without having any costs on other users.

The only goal that is broken is (4), but given that ICU4C has not had the correct mapping for a decade, I don't really see how (4) makes sense. @hsivonen's history spelunking paints a pretty clear story: Oracle wanted this code, then decided they didn't want it, and ICU4C didn't ever implement it. So we've had a calendar code out in the wild that nobody is actually implementing right, I don't see why we should start trying to implement it "right" today1.

How does this sound to you?

Footnotes

  1. For these reasons I somewhat consider the rgsa code to be "burned" anyway: if people did want that calendar, I would rather they use a new code minted with a more precise definition, rather than a code that has been poorly defined and mishandled by software for a decade.

@sffc
Copy link
Member

sffc commented Dec 16, 2025

ICU4C islamic-rgsa is islamic which is Reingold simulation-based. Evidence:

new Intl.DateTimeFormat("en", { calendar: "islamic", dateStyle: "long" }).format(new Date(2000, 0, 1))
'Ramadan 25, 1420 AH'
new Intl.DateTimeFormat("en", { calendar: "islamic-civil", dateStyle: "long" }).format(new Date(2000, 0, 1))
'Ramadan 24, 1420 AH'
new Intl.DateTimeFormat("en", { calendar: "islamic-rgsa", dateStyle: "long" }).format(new Date(2000, 0, 1))
'Ramadan 25, 1420 AH'
new Intl.DateTimeFormat("en", { calendar: "islamic-tbla", dateStyle: "long" }).format(new Date(2000, 0, 1))
'Ramadan 25, 1420 AH'
new Intl.DateTimeFormat("en", { calendar: "islamic-umalqura", dateStyle: "long" }).format(new Date(2000, 0, 1))
'Ramadan 24, 1420 AH'

new Intl.DateTimeFormat("en", { calendar: "islamic", dateStyle: "long" }).format(new Date(2001, 0, 1))
'Shawwal 7, 1421 AH'
new Intl.DateTimeFormat("en", { calendar: "islamic-civil", dateStyle: "long" }).format(new Date(2001, 0, 1))
'Shawwal 5, 1421 AH'
new Intl.DateTimeFormat("en", { calendar: "islamic-rgsa", dateStyle: "long" }).format(new Date(2001, 0, 1))
'Shawwal 7, 1421 AH'
new Intl.DateTimeFormat("en", { calendar: "islamic-tbla", dateStyle: "long" }).format(new Date(2001, 0, 1))
'Shawwal 6, 1421 AH'
new Intl.DateTimeFormat("en", { calendar: "islamic-umalqura", dateStyle: "long" }).format(new Date(2001, 0, 1))
'Shawwal 6, 1421 AH'

In the first set, islamic-rgsa aligns with islamic and islamic-tbla. In the second set it aligns with islamic only.

@Manishearth
Copy link
Member

From looking deeper, I might have been misled by this pair of ICU4C comments:

https://github.com/unicode-org/icu/blob/78ee8f6f9664a09ab34a0f3b954f2c7ba772955c/icu4c/source/i18n/islamcal.h#L50-L57

https://github.com/unicode-org/icu/blob/78ee8f6f9664a09ab34a0f3b954f2c7ba772955c/icu4c/source/i18n/islamcal.h#L650-L654

One says that IslamicCalendar is IslamicCivilCalendar, the other says that IslamicRgsaCalendar is IslamicCalendar.

Perhaps that comment is talking about different ctors? Looking through the code I can see this:

  • IslamicCalendar calls some astronomical functions
  • IslamicCivilCalendar overrides the hooks that call astronomical functions
  • IslamicRgsaCalendar is a thin inheritor of IslamicCalendar

So, documentation aside, IslamicCivilCalendar is not the same as IslamicRgsaCalendar.

@Manishearth
Copy link
Member

Manishearth commented Dec 16, 2025

Redoing my proposal from my previous comment in light of new info:

@sffc Most of your arguments are about why we ought to have such a type. Most of my concerns are about it showing up in AnyCalendar, how does this sound as a solution:

  • Do not handle islamic-rgsa in AnyCalendarKind's from-prefs parsing
  • The current AstronomicalSimulation type is deprecated and given Tabular-like behavior. This is strongly documented everywhere.
  • All AnyCalendar/Kind variants for this are deprecated
  • We introduce a new AstronomicalSimulation-like type with the current behavior. I can't think of a good name, unfortunately.

This means we can continue to have a type for this with the utility you propose, without having any costs on other users.

@sffc
Copy link
Member

sffc commented Dec 16, 2025

Most of my concerns are about it showing up in AnyCalendar

Can you elaborate or post a link to where you've previously elaborated on these concerns?

without having any costs on other users

I no longer consider HijriSimulated to be costly to other users since #7301 was merged.

I consider the documentation/reputational* cost of HijriSimulated not being HijriSimulated for the remainder of 2.x to be much greater than a few kB saved from a function that is much larger than that. I don't see a compelling reason not to kick the AnyCalendar decision down the road to 3.0.

* By "reputational" I mean that we've already landed too much deprecated stuff in icu_calendar, and it can give off the impression that we don't know what we're doing. What we have had since 2.0 is fine.

@Manishearth
Copy link
Member

Can you elaborate or post a link to where you've previously elaborated on these concerns?

Partly, in #7320 (comment)

I want AnyCalendar to contain "i18n-useful, production-quality calendars". I think HijriSimulated is not that useful on its own, though I think you've convinced me that it's something we should expose for people to build on top of.

I think there's an argument to be made that it is useful on its own since its errors are restricted to a single month at a time (unlike Chinese, where the entire year gets messed up), but I'd want to see how often those errors occur.

I worry about implicitly encouraging people to use an incomplete calendar by exposing it this way, even if we document it. I don't think it's a great look to say "here is a calendar in our default set, but beware, it's very often wrong". I think a fresh-slate approach to RGSA might be better.

Codesize also was a concern but it's probably resolved. I still don't enjoy carrying around the ~500B of data for the simulated history, but it's fine.

I recognize that with codesize resolved these concerns are not as strong.

I consider the documentation/reputational* cost of HijriSimulated not being HijriSimulated for the remainder of 2.x to be much greater than a few kB saved from a function that is much larger than that.

I think that's a good argument.

Note that the calendar types are already deprecated, it's just the variants and the Rules implementor that would be deprecated. So it's not much. But yes, it's a risk. I don't think most of our users are directly using these APIs so I am not convinced of the reputational cost.

Overall my experience in Rust is that deprecation is not in and of itself viewed as a bad thing (it shows a commitment to stability). Churn is, though, especially if APIs people are using get moved around a bunch, but I do not expect there to be many direct users of these types.

@robertbastian
Copy link
Member

I don't see what makes HijriSimulated special here, and why UAQ or tabular cannot be used as a basis. A previous argument that it's at most off by 1 day does not seem to be true (#7311 (comment)).

I no longer consider HijriSimulated to be costly to other users since #7301 was merged.

I agree, the packed data is 500B, code size shouldn't be much bigger either. In the grand scheme of AnyCalendar I don't think that's significant.

The only argument I really see is aligning with ICU4C. I'm not sure how good of an argument that is:

  • we already behave differently for the islamic preference (we pick the region's preferred Hijri calendar, ICU4C apparently picks simulated)
  • we don't align on Korean and Chinese (and, as of now, Japanese)
  • using the simulation for islamic-rgsa is knowingly wrong, it's just the best that ICU4C can do. However, it's not the best that ICU4X can do: clients can implement their own hijri::Rules using actual sightings, and set its calendar algorithm to islamic-rgsa. Given that this is possible, I don't think we should set the calendar algorithm for the simulated calendar to islamic-rgsa as well - it should just not have a calendar algorithm

The question is what to do with the islamic-rgsa preference in the AnyCalendarKind constructor, given that we will never have a correct sightings calendar in AnyCalendar:

  • use the region's default calendar
  • use the region's default Hijri calendar
  • use a fixed Hijri calendar (either UAQ or tabular)

@robertbastian
Copy link
Member

Interesting: the official Saudi sightings announced by the High Judiciary Council of Saudi Arabia might yield 31-day months, which is not compatible with our data model.

@hsivonen
Copy link
Member Author

hsivonen commented Dec 17, 2025

Shane: I think it is a good calendar

It's substantially different from the other calendars in ICU4X (except possibly JapaneseExtended, whose removal is being discussed):

The other calendars exist in the world independently of ICU4X, ICU4C, ICU4J, CLDR, and Reingold, and at least for near-present-day dates the ICU4X implementations are exact matches for the other existence and not approximations.

(To be clear, Saudi Arabia sighting exists independently of ICU4X, ICU4C, ICU4J, CLDR, and Reingold; I mean HijriSimulated<Mecca> as a calendar distinct from the actual sighting calendar. And also distinct from Umm al-Qura, the official Mecca-based simulation.)

Shane: I think it's a calendar that has use cases.

Are we trying to fit use cases to the situation being that we have the code, or are there use cases that make it necessary to have the code?

HijriSimulated is useful as a basis on top of which sighting adjustments can be made.

A calendar as a basis to apply sighting adjustments on top of does not appear to be a thing that ICU4X has been designed for. Have users asked for this, or is this about working from having code backwards towards a use case?

Microsoft's non-Umm al-Qura Hijri calendar (the one that corresponds to islamic-tbla in the default zero-adjustment configuration) supports five possible adjustments (-2, -1, 0, +1, +2) by a Windows registry entry. As I understand it, this is equivalent to moving the epoch start (which, it seems to me, means that islamic-civil matches one of the adjustment possibilities) and won't allow day 30 for a month in a year where tabular rule does not allow day 30.

It seems to me that this means that even for the purpose of displaying the current sighting-based date in the system UI, this has the issue of not being able to display day 30 when the tabular rule doesn't allow it. Furthermore, it seems that an adjustment that's made for the purpose of the current month also affecting calculations concerning past and future dates outside the current month could cause problems.

Do we know of user opinions of how well this Windows feature meets user needs?

ICU4C islamic-rgsa is islamic which is Reingold simulation-based.

In ICU4C (but not in ICU4J last I looked) islamic-rgsa just delegates to islamic, yes. I haven't been able to locate documentation for the parameters of ICU4C islamic. https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types says it's "influenced" by (an earlier edition of?) the Calendrical Calculations book, but it doesn't claim an exact algorithm match.

The sequence of events that resulted in islamic and islamic-rgsa being taken out of the Temporal calender list that's otherwise the CLDR list started with the realization that Cairo-parameter Reingold simulation did not match ICU4C's islamic. I gather that so far Mecca-parameter Reingold simulation hasn't been shown to match ICU4C's islamic, either.

So, documentation aside, IslamicCivilCalendar is not the same as IslamicRgsaCalendar.

Indeed it's not the same.

It appears that the first implementation in ICU4J had civil (tabular) and astronomical simulation in the same class with civil as the default and a civil flag that the caller could set to false to activate the astronomical simulation. Somewhere along the way the default has flipped the other way round so that ICU4C islamic (which islamic-rgsa delegates to in ICU4C) is an astronomical simulation.

reputation

cost

ICU4C has a reputation of representing i18n expertise and what it does has been assumed to be appropriate to expose to the Web. Dealing with the realization that ICU4C's islamic is undocumented and not known to match a calendar that exists outside ICU4C/ICU4J, which is a problem for independent implementation even ignoring use cases, and the realization that islamic-rgsa in ICU4C delegates to it without being a distinct fifth variant and without matching what the display name says has been costly across organizations in terms of the time spent.

I think as a reputational matter, we should avoid a situation where someone assumes that you get Saudi Arabia sighting from ICU4X when asking for islamic-rgsa returns a Hijri calendar, later realizes that they got something different, and then questions the correctness of ICU4X more generally.

The only argument I really see is aligning with ICU4C. I'm not sure how good of an argument that is:

A key part of how the ECMA side ended up in the current state was that it didn't seem useful to clone ICU4C's islamic line by line in ICU4X without evidence that doing so would address user needs.

using the simulation for islamic-rgsa is knowingly wrong

I think it's better to clearly not claim implementation than to be knowingly wrong.

The question is what to do with the islamic-rgsa preference in the AnyCalendarKind constructor, given that we will never have a correct sightings calendar in AnyCalendar:

I think the caller should not get a Hijri calendar to make it clear that we don't have actual islamic-rgsa available.

The TG2 answer from the December meeting has the outcome of "use the region's default calendar" for JavaScript Intl.DateTimeFormat, which in the current state of CLDR data isn't a lunar Hijri calendar for any locale.

@hsivonen
Copy link
Member Author

Interesting: the official Saudi sightings announced by the High Judiciary Council of Saudi Arabia might yield 31-day months, which is not compatible with our data model.

Furthermore, our model isn't compatible with the same (era, era-year, month, day) tuple being used for more than one rata die within one calendar.

We should not be treating Oracle's request for an identifier that OpenJDK didn't even ship with as a reason for ICU4X to ship a calendar.

@sffc
Copy link
Member

sffc commented Dec 18, 2025

The "request from Oracle" is completely irrelevant to the fact that islamic-rgsa has been shipping with this behavior for 12 years. It doesn't matter who requested it or asked for it or why it landed that way.

@Manishearth
Copy link
Member

FWIW, just looking at the code, the ICU4C implementation directly uses moonAge (the moon phase), i.e. it starts the month when the moon phase is a crescent, not when the crescent is visible from Mecca (or elsewhere). You can think of this as the "calendar as observed from the ISS" approximation.

https://github.com/unicode-org/icu/blob/4db86ea4b2f0899eca172c3f4af664e3e502901e/icu4c/source/i18n/islamcal.cpp#L359C9-L359C23

ICU4X's HijriSimulated was computed via fixed_from_observational_islamic (etc. I verified that this was the right set of functions in #6934, I wish the data had a comment about its provenance)

pub fn fixed_from_observational_islamic(
year: i32,
month: u8,
day: u8,
location: Location,
) -> RataDie {
let year = i64::from(year);
let month = i64::from(month);
let day = i64::from(day);
let midmonth = ISLAMIC_EPOCH_FRIDAY.to_f64_date()
+ (((year - 1) as f64) * 12.0 + month as f64 - 0.5) * MEAN_SYNODIC_MONTH;
let lunar_phase = Astronomical::calculate_new_moon_at_or_before(RataDie::new(midmonth as i64));
Astronomical::phasis_on_or_before(RataDie::new(midmonth as i64), location, Some(lunar_phase))
+ day
- 1
}

This includes location data for calculating phasis.

As noted previously, due to the nature of the Islamic calendar, this can at most cause one or two days to be labeled as being in the wrong month, but it's unclear to me how common that is.


Quick back of the envelope calculation: The Shaukat criterion looks for the new moon when the sun is 4.5 degrees below the horizon, and the moon is at least 4.1 degrees above. The moon-sun angle shifts by around 13 degrees a day.

This means that the Shaukat criterion is looking for situations where the moon-sun angle is between 8.6 and ~13 degrees on the day of the new moon. On the other hand, the ICU4C criterion is looking for a new moon, which is anywhere between 0 and 13 degrees.

So I'd imagine that ICU4C and ICU4X would diverge on month starts around a third of the time.

This is quick and dirty math and it's likely I've made a mistake. We should just compare the two.

@sffc
Copy link
Member

sffc commented Dec 19, 2025

When we implemented the calendrical calculations, we made the decision to implement from Reingold instead of porting ICU4C, so I wouldn't be surprised if the crescent criterion is different; hopefully the ICU4X criterion is better.

I don't want my position to differ based on a choice that was made to improve the quality of this calendar.

@Manishearth
Copy link
Member

That's fine, I just wanted to highlight that we are not implementing exactly what ICU4C does. It is specifically clarifying the facts presented in #7311 (comment)

@hsivonen
Copy link
Member Author

hsivonen commented Dec 19, 2025

The "request from Oracle" is completely irrelevant to the fact that islamic-rgsa has been shipping with this behavior for 12 years. It doesn't matter who requested it or asked for it or why it landed that way.

When there's an actual software compatibility constraint, it may be justified to do something that's knowingly not what it says on the label. (To be clear, for reasons upthread, I'm not suggesting making it do what it says on the label, I'm suggesting not pretending to have an implementation of islamic-rgsa.) In this case, there's no evidence a compatibility constraint requiring ICU4X to have a mapping for islamic-rgsa:

  • An HTTP Archive search indicated that islamic-rgsa is not used on the Web. (Search matches are to bulk copies of CLDR mentions of the string, not uses of the string as actual API input.)
  • islamic-rgsa was removed from the ECMA list.
  • The best-known non-Web ICU4C calendar exposure to users is macOS, and macOS in its system calendar setting omits islamic-rgsa.
  • ICU4X doesn't even implement the same thing as the supposed source of a compatibility constraint.

I find the argumentation that ICU4X should continue to have a mapping that isn't known to serve a software compatibility need, isn't know to address user needs, and is known not to be what it says on the label very frustrating.

The reason why I care is that ICU4C giving the appearance that it supports islamic-rgsa and then it turning out that it's not a distinct back end and that it doesn't do what the CLDR display name says has taken outsized time to figure out what to do about and it's bad to hand the opportunity for that situation to repeat onwards to the next person or, more selfishly, it's bad to set it up for surfacing back to the Web Platform context: it's bad for ICU4X, which is supposed to work as an ECMA-402+Temporal back end, to have unnecessary deviations from ECMA-402/Temporal, such as the mapping of islamic-rgsa or the specifics of the mapping for unqualified islamic.

@robertbastian
Copy link
Member

hopefully the ICU4X criterion is better.

I really really disagree with your characterisation that calendars are on a quality scale. They are not, they are either correct or not correct. ICU4C's implementation does not match what has been and will be observed in Mecca, and neither does ours. It doesn't matter that we tried to do the maths differently. In fact, it's bad that we created yet another Hijri calendar that doesn't actually exist.

@sffc
Copy link
Member

sffc commented Dec 19, 2025

I really really disagree with your characterisation that calendars are on a quality scale. They are not, they are either correct or not correct.

I really (really?) disagree with your characterization that these calendars are correct or not correct. There is no such thing as a generally correct Hijri calendar, since it is based on human observations. Umm al-Qura plasters over the problem in controverial ways, and Tabular makes no claim of matching ground truth. Developers working with Hijri calendars have multiple options to approximate the calendar, all with their own tradeoffs. HijriSimulated is one such option.

@robertbastian
Copy link
Member

There is no such thing as a generally correct Hijri calendar

There is a correct calendar for islamic-tbla, a correct calendar for islamic-civil, a correct calendar for islamic-umalqura, and a correct calendar for islamic-rgsa (which is impossible to implement, however). These are standardised calendars, meant for interchange.

@Manishearth
Copy link
Member

Manishearth commented Dec 19, 2025

There is no such thing as a generally correct Hijri calendar, since it is based on human observations

You are right that there is no generically correct Hijri calendar, but we're not trying to ship islamic here.

The way I see "correctness" of individual calendars is: Does it match what people use? Then it's correct, provided it is defined in a way that is sufficiently unambiguous about which calendar it is so that the people who use it can use it and the people who don't aren't misled.

The UAQ calendar is in use as a civil calendar. The Dawoodi Bohra calendar (which is one of the two Tabular ones, I can't remember which1), is in use: multiple Bohri friends of mine have it on their walls, and when I've asked about observations they've said "oh yeah we don't do that, other Muslim groups do that".

The goal of this library is not to provide religiously accurate calendars based on scriptural interpretation. The goal is to provide calendars that people can actually use, and in that sense, at least some of these calendars are in use.

Footnotes

  1. Edit: quick check comparing https://dawoodibohraapp.com/calendar/monthlycalendar.html with islamic-tbla shows that they are the same. Can't guarantee that this source is doing the right thing.

@sffc
Copy link
Member

sffc commented Dec 19, 2025

I do not want end users getting "bad" calendars due to their preferences [#7320]

something that's knowingly not what it says on the label

If someone reaches for islamic-rgsa assuming that it has the behavior on the CLDR documentation pages, it's bad for ICU4X to give them something which isn't that behavior.

If someone reaches for islamic-rgsa assuming that it has the behavior in ICU4C, i.e. a proleptic simulation, it's bad for ICU4X to give them something which isn't that behavior.

We can't implement the thing on the CLDR documentation pages, but we can implement the thing from ICU4C.

The Dawoodi Bohra calendar (which is one of the two Tabular ones [islamic-tbla]), is in use

Thanks, this is helpful background.

Is there evidence of islamic-civil being used by any groups?

@Manishearth
Copy link
Member

If someone reaches for islamic-rgsa assuming that it has the behavior in ICU4C, i.e. a proleptic simulation, it's bad for ICU4X to give them something which isn't that behavior.

Using my "developer preference vs user preference" distinction in #7320 (comment), I'm not sure that user preferences would be based on "the behavior from ICU4C". At best, user preferences would be based on "oh, this calendar is close enough to what I actually use". My understanding is that UAQ should also be "close enough", in that sense. Actually, it might be closer than ICU4C, since UAQ incorporates the Mecca sighting location in its math.

Developer preference could be based on ICU4C, but developers would likely be using the enum variants directly, not the codes, and they are best suited to be nudged by documentation.

Is there evidence of islamic-civil being used by any groups?

I remember doing research on this ages ago and finding some stuff, but I'm not sure. Overall, the Friday epoch seems to be more rare.

It would be nice to do this research properly at some point.

@robertbastian
Copy link
Member

@sffc yesterday you told us that ECMA is a VIP client. ECMA wants to treat islamic-rgsa as an unknown identifier. Afaik we have no client requesting us to treat is as an astronomical simulation.

Is there evidence of islamic-civil being used by any groups?

Can we please not relitigate all the other calendars.

@sffc
Copy link
Member

sffc commented Dec 19, 2025

@sffc yesterday you told us that ECMA is a VIP client. ECMA wants to treat islamic-rgsa as an unknown identifier. Afaik we have no client requesting us to treat is as an astronomical simulation.

My position is that if ECMA needs a feature that is best implemented in the core library, then we should do so. ECMA has a lot of weird handling of locale identifiers, and ICU4X exports all the necessary building blocks for it.

Is there evidence of islamic-civil being used by any groups?

Can we please not relitigate all the other calendars.

The status quo is that ICU4X ships the four models that ICU4C ships, with improvements to match Reingold better.

People seem to want to change the status quo to instead reflect things that are in real use. (I agree for 3.0 but disagree for 2.x)

If that is the case, then the corollary is that we should consider removing not only islamic-rgsa but also islamic-civil.

@Manishearth
Copy link
Member

The usage in Temporal means that islamic-civil cannot be removed regardless of whether it is used, until Temporal makes a decision on removing it.

This does not hold for rgsa or japanext.

I think it's definitely worth investigating: I am not happy with having calendars in our code where we do not have full documentation on what actual in-use calendar they map to. I also think it's not a priority to fix that.

The proposal is basically to switch from "ship what ICU4C ships" to "ship what Temporal wants". We have basically never actually shipped what ICU4C ships for most nontrivial calendars, aside from the basic code correspondence.

@hsivonen
Copy link
Member Author

Is there evidence of islamic-civil being used by any groups?

That's an interesting question for docs, both ICU4X and MDN. However, we don't need to explore that as a prerequisite to proceeding here.

The Hijri tabular concept as well as the parameters used for the particular instantiation exist independently of ICU4X/ICU4C/ICU4J/CLDR/Reingold, so we are not making up a calendar the way we are with HijriSimulated.

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

Successfully merging this pull request may close these issues.

4 participants