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

Case-sensitivity discrepancy between "new Temporal.TimeZone" and "Temporal.TimeZone.from" #2326

Closed
ptomato opened this issue Jun 22, 2022 · 2 comments · Fixed by #2395
Closed
Assignees
Labels
normative Would be a normative change to the proposal

Comments

@ptomato
Copy link
Collaborator

ptomato commented Jun 22, 2022

From #2292:

Temporal.TimeZone.from("pst8pdt") is still not accepted even though new Temporal.TimeZone("pst8pdt") works, but that's consistent with how new Temporal.TimeZone("etc/gmt+1") is treated differently than Temporal.TimeZone.from("etc/gmt+1").

This is surprising to me, I'd expect them to have the same case-sensitivity, but if there were any difference I'd expect from() to be more lenient.

Check if this is the case with calendars as well.

cc @anba @gibson042

@ptomato ptomato added the normative Would be a normative change to the proposal label Jun 22, 2022
@gibson042
Copy link
Collaborator

IsValidTimeZoneName is explicitly ASCII-case-insensitive and used by both Temporal.TimeZone and Temporal.TimeZone.from (the latter via ToTemporalTimeZone). I would expect uniformity.

@ptomato ptomato self-assigned this Aug 30, 2022
@ptomato
Copy link
Collaborator Author

ptomato commented Aug 30, 2022

This is mostly taken care of by CanonicalizeTimeZoneName, the only change is that we have to make IANA legacy names like "PST8PDT" valid case-insensitively, so that e.g. 2022-08-30T14:27[pst8pdt] is accepted.

For calendars we currently don't accept anything but lowercase, but that seems out of line with what ECMA-402 currently does. e.g. both of these are fine:

new Date().toLocaleString('en', {calendar: 'heBREw'})
new Date().toLocaleString('en-u-ca-heBREw')

So, I'd propose to accept calendar names case-insensitively as well.

To summarize, all of the following should work:

new Temporal.TimeZone('eTc/gMt+1')
Temporal.TimeZone.from('eTc/gMt+1')
Temporal.TimeZone.from('2022-08-30T14:29[eTc/gMt+1]')
new Temporal.Calendar('jApAnEsE')
Temporal.Calendar.from('jApAnEsE')
Temporal.Calendar.from('2022-08-30[u-ca=jApAnEsE]')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
normative Would be a normative change to the proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants