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

Coverage gap: Incorrect behaviour at end of range for Chinese calendar #3081

Open
ptomato opened this issue Feb 4, 2025 · 3 comments
Open
Labels
non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! test262

Comments

@ptomato
Copy link
Collaborator

ptomato commented Feb 4, 2025

Spotted by @Josh-Cena

const d = Temporal.PlainDate.from("+275760-09-13").withCalendar("chinese");
d.year; // RangeError
d.toPlainYearMonth(); // RangeError

This behaviour is not allowed by the spec. Any valid PlainDate must have a valid year property. The toPlainYearMonth method might throw at the beginning of the range if the first of the calendar month is outside the ISOPlainYearMonth range, but I believe that can't happen at the end of the range.

This behaviour isn't covered by test262. Firefox apparently has this bug.

@ptomato ptomato added non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! test262 labels Feb 4, 2025
@Josh-Cena
Copy link

Josh-Cena commented Feb 4, 2025

btw this happens for the other end too. A year that's too negative also throws.

It looks like this happens for chinese, dangi, islamic, islamic-rgsa, and islamic-umalqura, but not other calendars, but weirdly not for others including hebrew which I thought should be quite similar.

@anba
Copy link
Contributor

anba commented Feb 4, 2025

This behaviour isn't covered by test262. Firefox apparently has this bug.

It's not a bug per-se, but instead an additional restriction, because the ICU4X implementation doesn't yet handle large dates for some calendars. As soon as ICU4X is fixed, we can remove these limitation:

ICU4X issue: unicode-org/icu4x#4917

@anba
Copy link
Contributor

anba commented Feb 4, 2025

[...] not for others including hebrew which I thought should be quite similar.

The hebrew calendar doesn't have this restriction, because it uses plain math for its calculations: https://en.wikipedia.org/wiki/Hebrew_calendar#Calculations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
non-prod-polyfill THIS POLYFILL IS NOT FOR PRODUCTION USE! test262
Projects
None yet
Development

No branches or pull requests

3 participants