b90717df29
If we're testing printing in UTC timezone, then we have to be careful to also input the date in UTC, else local timezone will affect the test. Fixed: chromium:1135116 Change-Id: I49981c263e7b1fa1492b4644c5d4846fd94e5613 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2448793 Commit-Queue: Leszek Swirski <leszeks@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Santiago Aboy Solanes <solanes@chromium.org> Cr-Commit-Position: refs/heads/master@{#70312}
39 lines
1.6 KiB
JavaScript
39 lines
1.6 KiB
JavaScript
// 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.
|
|
|
|
let d1 = new Date(Date.UTC(2019, 4, 23));
|
|
|
|
// Ensure calendar: "japanese" under "ja" locale is correct.
|
|
assertEquals("R1/5/23", d1.toLocaleDateString(
|
|
"ja", {calendar: "japanese", timeZone:"UTC"}));
|
|
|
|
assertEquals("令和元年5月23日木曜日", d1.toLocaleDateString(
|
|
"ja", {calendar: "japanese", timeZone:"UTC", dateStyle: "full"}));
|
|
|
|
assertEquals("令和元年5月23日", d1.toLocaleDateString(
|
|
"ja", {calendar: "japanese", timeZone:"UTC", dateStyle: "long"}));
|
|
|
|
assertEquals("令和元年5月23日", d1.toLocaleDateString(
|
|
"ja", {calendar: "japanese", timeZone:"UTC", dateStyle: "medium"}));
|
|
|
|
assertEquals("R1/5/23", d1.toLocaleDateString(
|
|
"ja", {calendar: "japanese", timeZone:"UTC", dateStyle: "short"}));
|
|
|
|
// Ensure calendar: "chinese" under "zh" locale is correct.
|
|
d1 = new Date(Date.UTC(2020, 4, 23));
|
|
assertEquals("2020年闰四月1", d1.toLocaleDateString(
|
|
"zh", {calendar: "chinese", timeZone:"UTC"}));
|
|
|
|
assertEquals("2020庚子年闰四月初一星期六", d1.toLocaleDateString(
|
|
"zh", {calendar: "chinese", timeZone:"UTC", dateStyle: "full"}));
|
|
|
|
assertEquals("2020庚子年闰四月初一", d1.toLocaleDateString(
|
|
"zh", {calendar: "chinese", timeZone:"UTC", dateStyle: "long"}));
|
|
|
|
assertEquals("2020年闰四月初一", d1.toLocaleDateString(
|
|
"zh", {calendar: "chinese", timeZone:"UTC", dateStyle: "medium"}));
|
|
|
|
assertEquals("2020/闰4/1", d1.toLocaleDateString(
|
|
"zh", {calendar: "chinese", timeZone:"UTC", dateStyle: "short"}));
|