regress-1107661.js 1.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// The following numberingSystems are not supported yet
const algorithmicNumberingSystems = [
  "armn", "armnlow", "cyrl", "ethi", "geor", "grek", "greklow", "hans",
  "hansfin", "hant", "hantfin", "hebr", "jpan", "jpanfin", "roman", "romanlow",
  "taml"
];

algorithmicNumberingSystems.forEach(function(numberingSystem) {
  let df = new Intl.DateTimeFormat("en", {dateStyle: "full", numberingSystem});
14 15 16
  if (df.resolvedOptions().numberingSystem != numberingSystem) {
    assertEquals("latn", df.resolvedOptions().numberingSystem);
  }
17 18 19

  let df2 = new Intl.DateTimeFormat("en-u-nu-" + numberingSystem,
      {dateStyle: "full"});
20 21 22 23

  if (df2.resolvedOptions().numberingSystem != numberingSystem) {
    assertEquals("latn", df2.resolvedOptions().numberingSystem);
  }
24 25 26 27

  // Just verify it won't crash
  (new Date()).toLocaleString("en-u-nu-" + numberingSystem, {dateStyle: "full"});
});