Skip to content

Commit

Permalink
Update UTC time zone canonicalization to match proposal-canonical-tz
Browse files Browse the repository at this point in the history
The test for tc39/ecma402#724 (added in
#4328) didn't take the Time Zone
Canonicalization proposal into account; but it should, because that
proposal is stage 3.

As of that proposal, the [[TimeZone]] slot of DateTimeFormat gets the
case-regularized original identifier, no longer the primary identifier. So
the resolvedOptions().timeZone property also no longer returns the primary
identifier.
  • Loading branch information
ptomato committed Dec 4, 2024
1 parent 901dd6e commit 575a974
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/intl402/DateTimeFormat/canonicalize-utc-timezone.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ info: |
5. For each element identifier of identifiers, do
...
c. If primary is one of "Etc/UTC", "Etc/GMT", or "GMT", set primary to "UTC".
features: [Temporal]
---*/

const utcIdentifiers = ["Etc/GMT", "Etc/UTC", "GMT"];

for (const timeZone of utcIdentifiers) {
assert.sameValue(new Intl.DateTimeFormat([], {timeZone}).resolvedOptions().timeZone, "UTC", "Time zone name " + timeZone + " not canonicalized to 'UTC'.");
const dateTime = new Temporal.ZonedDateTime(0n, timeZone);
const utcDateTime = new Temporal.ZonedDateTime(0n, "UTC");
assert(dateTime.equals(utcDateTime), "Time zone name " + timeZone + " should be equal to primary identifier 'UTC'.");
}

0 comments on commit 575a974

Please sign in to comment.