mirror of
https://github.com/tc39/test262.git
synced 2025-07-03 12:14:37 +02:00
The test for https://github.com/tc39/ecma402/pull/724 (added in https://github.com/tc39/test262/pull/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.
35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
// Copyright 2024 Igalia, S.L. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
/*---
|
|
esid: sec-createdatetimeformat
|
|
description: >
|
|
Tests that the time zone names "Etc/UTC", "Etc/GMT", and "GMT" are not
|
|
canonicalized to "UTC" in "resolvedOptions".
|
|
info: |
|
|
CreateDateTimeFormat ( dateTimeFormat, locales, options, required, default )
|
|
|
|
30. If IsTimeZoneOffsetString(timeZone) is true, then
|
|
...
|
|
31. Else,
|
|
a. Let timeZoneIdentifierRecord be GetAvailableNamedTimeZoneIdentifier(timeZone).
|
|
...
|
|
c. Set timeZone to timeZoneIdentifierRecord.[[Identifier]].
|
|
|
|
GetAvailableNamedTimeZoneIdentifier ( timeZoneIdentifier )
|
|
|
|
1. For each element record of AvailableNamedTimeZoneIdentifiers(), do
|
|
a. If record.[[Identifier]] is an ASCII-case-insensitive match for
|
|
timeZoneIdentifier, return record.
|
|
|
|
features: [canonical-tz]
|
|
---*/
|
|
|
|
const utcIdentifiers = ["Etc/GMT", "Etc/UTC", "GMT"];
|
|
|
|
for (const timeZone of utcIdentifiers) {
|
|
assert.sameValue(
|
|
new Intl.DateTimeFormat([], {timeZone}).resolvedOptions().timeZone,
|
|
timeZone,
|
|
"Time zone name " + timeZone + " should be preserved and not canonicalized to 'UTC'");
|
|
}
|