v8/test/intl/date-format/time_style_hour_cycle.js
Frank Tang 08c469719c [intl] Migrate to ICU 72
DEPS change in chromium is in
https://chromium-review.googlesource.com/c/chromium/src/+/3995549
and should be landed first.

This CL fix all the broken test in v8.

ICU72 release note https://icu.unicode.org/download/72
CLDR42 release note https://cldr.unicode.org/index/downloads/cldr-42

Key changes
1. Fix the test expectation for the formatted date string
a. use U+202f (narrow nbsp) before "PM" and "AM".
b. use U+200A (thin space) around U+2013 in date duration format.
2. Mark the test262 breakage.

Bug: chromium:1371208
Change-Id: I4e2ecc6330845a2bf86711bc4ee6fe6407f140c1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4004606
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84374}
2022-11-21 07:04:20 +00:00

55 lines
2.2 KiB
JavaScript

// Copyright 2019 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 midnight = new Date(2019, 3, 4, 0);
let noon = new Date(2019, 3, 4, 12);
let df_11_t = new Intl.DateTimeFormat(
"en", {timeStyle: "short", hourCycle: "h11"})
assertEquals("h11", df_11_t.resolvedOptions().hourCycle);
assertEquals("0:00\u202fAM", df_11_t.format(midnight));
assertEquals("0:00\u202fPM", df_11_t.format(noon));
let df_12_t = new Intl.DateTimeFormat(
"en", {timeStyle: "short", hourCycle: "h12"})
assertEquals("h12", df_12_t.resolvedOptions().hourCycle);
assertEquals("12:00\u202fAM", df_12_t.format(midnight));
assertEquals("12:00\u202fPM", df_12_t.format(noon));
let df_23_t = new Intl.DateTimeFormat(
"en", {timeStyle: "short", hourCycle: "h23"})
assertEquals("h23", df_23_t.resolvedOptions().hourCycle);
assertEquals("00:00", df_23_t.format(midnight));
assertEquals("12:00" ,df_23_t.format(noon));
let df_24_t = new Intl.DateTimeFormat(
"en", {timeStyle: "short", hourCycle: "h24"})
assertEquals("h24", df_24_t.resolvedOptions().hourCycle);
assertEquals("24:00", df_24_t.format(midnight));
assertEquals("12:00", df_24_t.format(noon));
let df_11_ja_t = new Intl.DateTimeFormat(
"ja-JP", {timeStyle: "short", hourCycle: "h11"})
assertEquals("h11", df_11_ja_t.resolvedOptions().hourCycle);
assertEquals("午前0:00", df_11_ja_t.format(midnight));
assertEquals("午後0:00", df_11_ja_t.format(noon));
let df_12_ja_t = new Intl.DateTimeFormat(
"ja-JP", {timeStyle: "short", hourCycle: "h12"})
assertEquals("h12", df_12_ja_t.resolvedOptions().hourCycle);
assertEquals("午前12:00", df_12_ja_t.format(midnight));
assertEquals("午後12:00", df_12_ja_t.format(noon));
let df_23_ja_t = new Intl.DateTimeFormat(
"ja-JP", {timeStyle: "short", hourCycle: "h23"})
assertEquals("h23", df_23_ja_t.resolvedOptions().hourCycle);
assertEquals("0:00", df_23_ja_t.format(midnight));
assertEquals("12:00", df_23_ja_t.format(noon));
let df_24_ja_t = new Intl.DateTimeFormat(
"ja-JP", {timeStyle: "short", hourCycle: "h24"})
assertEquals("h24", df_24_ja_t.resolvedOptions().hourCycle);
assertEquals("24:00", df_24_ja_t.format(midnight));
assertEquals("12:00", df_24_ja_t.format(noon));