summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/DateTimeFormat/timezone-not-canonicalized.js
blob: 7218ad448bf767c7f7808d8ec7990c6af2a87553 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2023 Justin Grant. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-initializedatetimeformat
description: Time zone identifiers are not canonicalized before storing in internal slots
---*/

const baseOptions = {
  timeZoneName: "long",
  year: "numeric",
  month: "long",
  day: "numeric",
  hour: "numeric",
  minute: "numeric"
};
const dtf1 = new Intl.DateTimeFormat("en", { ...baseOptions, timeZone: "Asia/Calcutta" });
const dtf2 = new Intl.DateTimeFormat("en", { ...baseOptions, timeZone: "Asia/Kolkata" });

const resolvedId1 = dtf1.resolvedOptions().timeZone;
const resolvedId2 = dtf2.resolvedOptions().timeZone;

const output1 = dtf1.format(0);
const output2 = dtf2.format(0);

assert.sameValue(output1, output2);
assert.sameValue(resolvedId1, "Asia/Calcutta");
assert.sameValue(resolvedId2, "Asia/Kolkata");

reportCompare(0, 0);