v8/test/intl/date-format/timezone-conversion.js
Frank Tang d7ae63e6f2 [Intl] Move toLDMLString & canonicalizeTimeZoneID js->C++
Bug: v8:8066
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng;luci.chromium.try:linux_chromium_rel_ng
Change-Id: I74fe09bb6bb4428d57c66811b77f5f35144f717f
Reviewed-on: https://chromium-review.googlesource.com/1186153
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Jungshik Shin <jshin@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55625}
2018-09-04 22:37:56 +00:00

18 lines
753 B
JavaScript

// Copyright 2018 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.
//
// Tests time zone support with conversion.
df = Intl.DateTimeFormat(undefined, {timeZone: 'America/Los_Angeles'});
assertEquals('America/Los_Angeles', df.resolvedOptions().timeZone);
df = Intl.DateTimeFormat(undefined, {timeZone: {toString() { return 'America/Los_Angeles'}}});
assertEquals('America/Los_Angeles', df.resolvedOptions().timeZone);
assertThrows(() => Intl.DateTimeFormat(
undefined, {timeZone: {toString() { throw new Error("should throw"); }}}));
assertThrows(() => Intl.DateTimeFormat(
undefined, {get timeZone() { throw new Error("should throw"); }}));