Skip to content

Commit 575a974

Browse files
committed
Update UTC time zone canonicalization to match proposal-canonical-tz
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.
1 parent 901dd6e commit 575a974

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/intl402/DateTimeFormat/canonicalize-utc-timezone.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ info: |
1717
5. For each element identifier of identifiers, do
1818
...
1919
c. If primary is one of "Etc/UTC", "Etc/GMT", or "GMT", set primary to "UTC".
20+
features: [Temporal]
2021
---*/
2122

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

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

0 commit comments

Comments
 (0)