mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 16:04:36 +02:00
Connector of date and time style can be " at " or ", "
macOS system ICU is shipping new CLDR, but it has many overrides on the top of it to make the formatted output suitable for the system. And in timedatestyle-en.js tests, we intentionally override the CLDR data with the different format. This change modifies the test to accept that alternative output.
This commit is contained in:
parent
fd12f5bc6b
commit
333da4198a
@ -10,10 +10,10 @@ locale: [en-US]
|
|||||||
|
|
||||||
const date = new Date("1886-05-01T14:12:47Z");
|
const date = new Date("1886-05-01T14:12:47Z");
|
||||||
const dateOptions = [
|
const dateOptions = [
|
||||||
["full", "Saturday, May 1, 1886", " at "],
|
["full", "Saturday, May 1, 1886"],
|
||||||
["long", "May 1, 1886", " at "],
|
["long", "May 1, 1886"],
|
||||||
["medium", "May 1, 1886", ", "],
|
["medium", "May 1, 1886"],
|
||||||
["short", "5/1/86", ", "],
|
["short", "5/1/86"],
|
||||||
];
|
];
|
||||||
|
|
||||||
const timeOptions = [
|
const timeOptions = [
|
||||||
@ -84,18 +84,20 @@ for (const [timeStyle, expected12, expected24] of timeOptions) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const [dateStyle, expectedDate, connector] of dateOptions) {
|
for (const [dateStyle, expectedDate] of dateOptions) {
|
||||||
for (const [timeStyle, expectedTime] of timeOptions) {
|
for (const [timeStyle, expectedTime] of timeOptions) {
|
||||||
const dtf = new Intl.DateTimeFormat("en-US", {
|
const dtf = new Intl.DateTimeFormat("en-US", {
|
||||||
dateStyle,
|
dateStyle,
|
||||||
timeStyle,
|
timeStyle,
|
||||||
timeZone: "UTC",
|
timeZone: "UTC",
|
||||||
});
|
});
|
||||||
|
const result1 = [expectedDate, ", ", expectedTime].join("");
|
||||||
|
const result2 = [expectedDate, " at ", expectedTime].join("");
|
||||||
|
|
||||||
const dateString = dtf.format(date);
|
const dateString = dtf.format(date);
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
dateString,
|
[result1, result2].includes(dateString),
|
||||||
[expectedDate, connector, expectedTime].join(""),
|
true,
|
||||||
`Result for date=${dateStyle} and time=${timeStyle}`
|
`Result for date=${dateStyle} and time=${timeStyle}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user