|
2 | 2 | // This code is governed by the BSD license found in the LICENSE file.
|
3 | 3 | /*---
|
4 | 4 | esid: sec-createdatetimeformat
|
5 |
| -description: Tests that the time zone names "Etc/UTC", "Etc/GMT", and "GMT" all resolve to "UTC". |
| 5 | +description: > |
| 6 | + Tests that the time zone names "Etc/UTC", "Etc/GMT", and "GMT" are not |
| 7 | + canonicalized to "UTC" in "resolvedOptions". |
6 | 8 | info: |
|
7 | 9 | CreateDateTimeFormat ( dateTimeFormat, locales, options, required, default )
|
8 | 10 |
|
9 |
| - 29. If IsTimeZoneOffsetString(timeZone) is true, then |
| 11 | + 30. If IsTimeZoneOffsetString(timeZone) is true, then |
10 | 12 | ...
|
11 |
| - 30. Else, |
| 13 | + 31. Else, |
12 | 14 | a. Let timeZoneIdentifierRecord be GetAvailableNamedTimeZoneIdentifier(timeZone).
|
| 15 | + ... |
| 16 | + c. Set timeZone to timeZoneIdentifierRecord.[[Identifier]]. |
13 | 17 |
|
14 | 18 | GetAvailableNamedTimeZoneIdentifier ( timeZoneIdentifier )
|
15 | 19 |
|
16 |
| - ... |
17 |
| - 5. For each element identifier of identifiers, do |
18 |
| - ... |
19 |
| - c. If primary is one of "Etc/UTC", "Etc/GMT", or "GMT", set primary to "UTC". |
| 20 | + 1. For each element record of AvailableNamedTimeZoneIdentifiers(), do |
| 21 | + a. If record.[[Identifier]] is an ASCII-case-insensitive match for |
| 22 | + timeZoneIdentifier, return record. |
| 23 | +
|
| 24 | +features: [canonical-tz] |
20 | 25 | ---*/
|
21 | 26 |
|
22 | 27 | const utcIdentifiers = ["Etc/GMT", "Etc/UTC", "GMT"];
|
23 | 28 |
|
24 | 29 | for (const timeZone of utcIdentifiers) {
|
25 |
| - assert.sameValue(new Intl.DateTimeFormat([], {timeZone}).resolvedOptions().timeZone, "UTC", "Time zone name " + timeZone + " not canonicalized to 'UTC'."); |
| 30 | + assert.notSameValue( |
| 31 | + new Intl.DateTimeFormat([], {timeZone}).resolvedOptions().timeZone, |
| 32 | + "UTC", |
| 33 | + "Time zone name " + timeZone + " should not be canonicalized to 'UTC'."); |
26 | 34 | }
|
0 commit comments