• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5if (this.Intl) {
6  // Normalizes Kat{h,}mandu (chromium:487322)
7  // According to the IANA timezone db, Kathmandu is the current canonical
8  // name, but ICU got it backward. To make this test robust against a future
9  // ICU change ( http://bugs.icu-project.org/trac/ticket/12044 ),
10  // just check that Kat(h)mandu is resolved identically.
11  df1 = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Katmandu'})
12  df2 = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Kathmandu'})
13  assertEquals(df1.resolvedOptions().timeZone, df2.resolvedOptions().timeZone);
14
15  // Normalizes Ulan_Bator to Ulaanbaatar. Unlike Kat(h)mandu, ICU got this
16  // right so that we make sure that Ulan_Bator is resolved to Ulaanbaatar.
17  df = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Ulaanbaatar'})
18  assertEquals('Asia/Ulaanbaatar', df.resolvedOptions().timeZone);
19
20  df = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Ulan_Bator'})
21  assertEquals('Asia/Ulaanbaatar', df.resolvedOptions().timeZone);
22
23  // Throws for unsupported time zones.
24  assertThrows(() => Intl.DateTimeFormat(undefined, {timeZone: 'Aurope/Paris'}));
25}
26