v8/test/intl/date-format/en-format-range-to-parts.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

48 lines
1.9 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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.
const date1 = new Date("2019-01-03T03:20");
const date2 = new Date("2019-01-05T19:33");
const date3 = new Date("2019-01-05T22:57");
// value: "Jan 3 5, 2019"
// source: hhhhShhhEhhhhhh
// type: mmmldllldllyyyy
// h: Shared, S: startRange, E: endRange
// m: month, l: literal, d: day, y: year
const expected1 = [
{type: "month", value: "Jan", source: "shared"},
{type: "literal", value: " ", source: "shared"},
{type: "day", value: "3", source: "startRange"},
{type: "literal", value: "\u2009\u2009", source: "shared"},
{type: "day", value: "5", source: "endRange"},
{type: "literal", value: ", ", source: "shared"},
{type: "year", value: "2019", source: "shared"}
];
var dtf = new Intl.DateTimeFormat(["en"], {year: "numeric", month: "short", day: "numeric"});
const ret1 = dtf.formatRangeToParts(date1, date2);
assertEquals(expected1, ret1);
// value: "Jan 5, 7 10 PM"
// source: hhhhhhhShhhEEhhh
// type: mmmldlldlllhhlpp
// h: Shared, S: startRange, E: endRange
// m: month, l: literal, d: day, h: hour, p: dayPeriod
const expected2 = [
{type: "month", value: "Jan", source: "shared"},
{type: "literal", value: " ", source: "shared"},
{type: "day", value: "5", source: "shared"},
{type: "literal", value: ", ", source: "shared"},
{type: "hour", value: "7", source: "startRange"},
{type: "literal", value: "\u2009\u2009", source: "shared"},
{type: "hour", value: "10", source: "endRange"},
{type: "literal", value: "\u202f", source: "shared"},
{type: "dayPeriod", value: "PM", source: "shared"}
];
dtf = new Intl.DateTimeFormat(["en"], {month: "short", day: "numeric", hour: "numeric"});
const ret2 = dtf.formatRangeToParts(date2, date3);
assertEquals(expected2, ret2);