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

#2482 made DefaultTimeZone's result is now observable (matters for offset strings) #2584

Closed
justingrant opened this issue May 22, 2023 · 2 comments · Fixed by #2607
Closed

Comments

@justingrant
Copy link
Collaborator

justingrant commented May 22, 2023

When we introduced Temporal.Now.timeZoneId() as part of the implementer-requested string slots change in #2482, we inadvertently made the result of DefaultTimeZone observable. Previously, this AO's result was only surfaced indirectly:

In both of the "indirectly exposed" cases above, if the system time zone is an IANA time zone, then it will be canonicalized. But if it's an offset string, then the spec is unclear about what will happen.

The spec text for DefaultTimeZone (both in 402 and in tc39/ecma262#3035 which should hopefully be merged soon) is clear that IANA time zones will be canonicalized. But both are silent about offset time zones. I'm open to adding a canonicalization step to that 262 AO later, e.g. in a normative PR or in proposal-canonical-tz, but wondering what to do in the meantime (or if that doesn't happen).

What should Temporal.Now.timeZoneId() do if the input is an offset string?

  • Call CanonicalizeTimeZoneOffsetString, and remove that call if DefaultTimeZone adds a normalization step later?
  • Assert it's already in normalized form, and remove the assertion if DefaultTimeZone adds an assertion later?
  • Throw, and remove that throwing as part of 402's work to support offset strings? (ECMA-402 should allow numeric-offset host time zones ecma402#683) And remove that throwing if DefaultTimeZone throws later?
@ptomato
Copy link
Collaborator

ptomato commented May 23, 2023

I think this is something that the time zone canonicalization proposal should solve. Time zone identifier canonicalization currently isn't a thing in ECMA-262, only in ECMA-402, so there's nothing that Temporal could do about this in ECMA-262's DefaultTimeZone without bringing canonicalization to 262 — which would essentially mean absorbing the time zone canonicalization proposal.

I prefer your first bullet point, adding an assertion in DefaultTimeZone.

@justingrant justingrant changed the title DefaultTimeZone can return a non-canonical offset string Bug? DefaultTimeZone's result is now observable after #2482 (matters for offset strings) May 25, 2023
@justingrant justingrant changed the title Bug? DefaultTimeZone's result is now observable after #2482 (matters for offset strings) #2482 made DefaultTimeZone's result is now observable (matters for offset strings) May 25, 2023
@justingrant
Copy link
Collaborator Author

Meeting 2023-05-25: We'll handle this by expanding the scope of proposal-canonical-tz (or perhaps by a separate normative PR to 262) to include a normative change to DefaultTimeZone that ensures that offset strings are in normal form before returning them.

justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jun 28, 2023
This commit adds prose to clarify that if SystemTimeZoneIdentifier
returns an offset time zone identifier, then it should be in normal form
like "-05:00" not "-0500" nor "-05".

No current implementations support returning offset strings in non-
normal form today. So although this commit is normative, it won't
break any existing ECMAScript code nor will it require changes to
any current implementation.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jun 29, 2023
This commit adds prose to clarify that if SystemTimeZoneIdentifier
returns an offset time zone identifier, then it should be in normal form
like "-05:00" not "-0500" nor "-05".

No current implementations support returning offset strings in non-
normal form today. So although this commit is normative, it won't
break any existing ECMAScript code nor will it require changes to
any current implementation.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jun 29, 2023
This commit adds prose to clarify that if SystemTimeZoneIdentifier
returns an offset time zone identifier, then it should be in normal form
like "-05:00" not "-0500" nor "-05".

No current implementations support returning offset strings in non-
normal form today. So although this commit is normative, it won't
break any existing ECMAScript code nor will it require changes to
any current implementation.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jun 29, 2023
This commit adds prose to clarify that if SystemTimeZoneIdentifier
returns an offset time zone identifier, then it should be in normal form
like "-05:00" not "-0500" nor "-05".

No current implementations support returning offset strings in non-
normal form today. So although this commit is normative, it won't
break any existing ECMAScript code nor will it require changes to
any current implementation.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jun 29, 2023
This commit adds prose to clarify that if SystemTimeZoneIdentifier
returns an offset time zone identifier, then it should be in normal form
like "-05:00" not "-0500" nor "-05".

No current implementations support returning offset strings in non-
normal form today. So although this commit is normative, it won't
break any existing ECMAScript code nor will it require changes to
any current implementation.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jun 29, 2023
This commit adds prose to clarify that if SystemTimeZoneIdentifier
returns an offset time zone identifier, then it should be in normal form
like "-05:00" not "-0500" nor "-05".

No current implementations support returning offset strings in non-
normal form today. So although this commit is normative, it won't
break any existing ECMAScript code nor will it require changes to
any current implementation.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jun 29, 2023
This commit adds prose to clarify that if SystemTimeZoneIdentifier
returns an offset time zone identifier, then it should be in normal form
like "-05:00" not "-0500" nor "-05".

No current implementations support returning offset strings in non-
normal form today. So although this commit is normative, it won't
break any existing ECMAScript code nor will it require changes to
any current implementation.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jul 1, 2023
This commit adds a "normalized format of a time zone identifier"
definition, and uses it to ensure that SystemTimeZoneIdentifier only
returns normalized identifiers like "-05:00" (not "-0500" nor "-05")
or "America/Los_Angeles" (not "AMERICA/LOS_ANGELES" nor
"AmErIcA/lOs_AnGeLeS").

No current implementations return offset strings in non-normalized
format, so although this is a normative change, it won't break existing
ECMAScript code nor will it require changes to current implementations.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jul 3, 2023
This commit adds a "normalized format of a time zone identifier"
definition, and uses it to ensure that SystemTimeZoneIdentifier only
returns normalized identifiers like "-05:00" (not "-0500" nor "-05")
or "America/Los_Angeles" (not "AMERICA/LOS_ANGELES" nor
"AmErIcA/lOs_AnGeLeS").

No current implementations return offset strings in non-normalized
format, so although this is a normative change, it won't break existing
ECMAScript code nor will it require changes to current implementations.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jul 15, 2023
This commit adds a "normalized format of a time zone identifier"
definition, and uses it to ensure that SystemTimeZoneIdentifier only
returns normalized identifiers like "-05:00" (not "-0500" nor "-05")
or "America/Los_Angeles" (not "AMERICA/LOS_ANGELES" nor
"AmErIcA/lOs_AnGeLeS").

No current implementations return offset strings in non-normalized
format, so although this is a normative change, it won't break existing
ECMAScript code nor will it require changes to current implementations.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jul 16, 2023
This commit adds a "normalized format of a time zone identifier"
definition, and uses it to ensure that SystemTimeZoneIdentifier only
returns normalized identifiers like "-05:00" (not "-0500" nor "-05")
or "America/Los_Angeles" (not "AMERICA/LOS_ANGELES" nor
"AmErIcA/lOs_AnGeLeS").

No current implementations return offset strings in non-normalized
format, so although this is a normative change, it won't break existing
ECMAScript code nor will it require changes to current implementations.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jul 16, 2023
This commit adds a "normalized format of a time zone identifier"
definition, and uses it to ensure that SystemTimeZoneIdentifier only
returns normalized identifiers like "-05:00" (not "-0500" nor "-05")
or "America/Los_Angeles" (not "AMERICA/LOS_ANGELES" nor
"AmErIcA/lOs_AnGeLeS").

No current implementations return offset strings in non-normalized
format, so although this is a normative change, it won't break existing
ECMAScript code nor will it require changes to current implementations.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jul 17, 2023
This commit adds a "normalized format of a time zone identifier"
definition, and uses it to ensure that SystemTimeZoneIdentifier only
returns normalized identifiers like "-05:00" (not "-0500" nor "-05")
or "America/Los_Angeles" (not "AMERICA/LOS_ANGELES" nor
"AmErIcA/lOs_AnGeLeS").

No current implementations return offset strings in non-normalized
format, so although this is a normative change, it won't break existing
ECMAScript code nor will it require changes to current implementations.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jul 18, 2023
This commit adds a "normalized format of a time zone identifier"
definition, and uses it to ensure that SystemTimeZoneIdentifier only
returns normalized identifiers like "-05:00" (not "-0500" nor "-05")
or "America/Los_Angeles" (not "AMERICA/LOS_ANGELES" nor
"AmErIcA/lOs_AnGeLeS").

No current implementations return offset strings in non-normalized
format, so although this is a normative change, it won't break existing
ECMAScript code nor will it require changes to current implementations.

Fixes tc39#2584.
justingrant added a commit to justingrant/proposal-temporal that referenced this issue Jul 18, 2023
This commit adds a "normalized format of a time zone identifier"
definition, and uses it to ensure that SystemTimeZoneIdentifier only
returns normalized identifiers like "-05:00" (not "-0500" nor "-05")
or "America/Los_Angeles" (not "AMERICA/LOS_ANGELES" nor
"AmErIcA/lOs_AnGeLeS").

No current implementations return offset strings in non-normalized
format, so although this is a normative change, it won't break existing
ECMAScript code nor will it require changes to current implementations.

Fixes tc39#2584.
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 a pull request may close this issue.

2 participants