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

Polyfill: RangeError thrown when parsing calendar from time-only string #3090

Open
anba opened this issue Feb 14, 2025 · 1 comment
Open
Labels

Comments

@anba
Copy link
Contributor

anba commented Feb 14, 2025

Test case:

new Temporal.PlainDate(2025, 1, 1, "gregory").withCalendar("01").calendarId

Expected: Return the string "iso8601".
Actual: Throws a RangeError.

ParseTemporalCalendarString, step 2.b defaults to using "iso8601" when no calendar is present in the input string.

@ptomato
Copy link
Collaborator

ptomato commented Feb 15, 2025

Thanks for catching this. I'll submit a PR to fix the reference code. The spec text is correct, no change needed there.

As usual, the fact that this wasn't caught until now means a test262 coverage gap, so I'll keep this issue open and add the test262 label.

ptomato added a commit that referenced this issue Feb 15, 2025
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalcalendarstring
ParseTemporalCalendarString specifies to try to parse the string as
TemporalDateTimeString[+Zoned], TemporalDateTimeString[~Zoned],
TemporalInstantString, TemporalTimeString, TemporalMonthDayString, and
TemporalYearMonthString consecutively until one succeeds. I always thought
TemporalTimeString would be handled by ParseISODateTime in the polyfill,
but it seems I was wrong about that.

See: #3090
ptomato added a commit that referenced this issue Feb 24, 2025
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalcalendarstring
ParseTemporalCalendarString specifies to try to parse the string as
TemporalDateTimeString[+Zoned], TemporalDateTimeString[~Zoned],
TemporalInstantString, TemporalTimeString, TemporalMonthDayString, and
TemporalYearMonthString consecutively until one succeeds. I always thought
TemporalTimeString would be handled by ParseISODateTime in the polyfill,
but it seems I was wrong about that.

See: #3090
ptomato added a commit that referenced this issue Feb 25, 2025
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalcalendarstring
ParseTemporalCalendarString specifies to try to parse the string as
TemporalDateTimeString[+Zoned], TemporalDateTimeString[~Zoned],
TemporalInstantString, TemporalTimeString, TemporalMonthDayString, and
TemporalYearMonthString consecutively until one succeeds. I always thought
TemporalTimeString would be handled by ParseISODateTime in the polyfill,
but it seems I was wrong about that.

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

No branches or pull requests

2 participants