Debian Codegraph @

js/src/tests/test262/intl402/DateTimeFormat/timezone-not-canonicalized.js

raw
1 // Copyright (C) 2023 Justin Grant. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-initializedatetimeformat
6 description: Time zone identifiers are not canonicalized before storing in internal slots
7 features: [canonical-tz]
8 ---*/
9
10 const baseOptions = {
11 timeZoneName: "long",
12 year: "numeric",
13 month: "long",
14 day: "numeric",
15 hour: "numeric",
16 minute: "numeric"
17 };
18 const dtf1 = new Intl.DateTimeFormat("en", { ...baseOptions, timeZone: "Asia/Calcutta" });
19 const dtf2 = new Intl.DateTimeFormat("en", { ...baseOptions, timeZone: "Asia/Kolkata" });
20
21 const resolvedId1 = dtf1.resolvedOptions().timeZone;
22 const resolvedId2 = dtf2.resolvedOptions().timeZone;
23
24 const output1 = dtf1.format(0);
25 const output2 = dtf2.format(0);
26
27 assert.sameValue(output1, output2);
28 assert.sameValue(resolvedId1, "Asia/Calcutta");
29 assert.sameValue(resolvedId2, "Asia/Kolkata");
30
31 reportCompare(0, 0);