mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 23:44:27 +02:00
Fix Temporal test failures under Node 19
This commit is contained in:
parent
8cd563f978
commit
d8bc356d01
@ -8,10 +8,23 @@ locale: [en]
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
// Using 24-hour clock to avoid format differences between Node 19 (which puts
|
||||||
|
// "\u{202f}" before AM/PM) and previous versions that use regular spaces.
|
||||||
|
const options = {
|
||||||
|
timeZone: "Pacific/Apia",
|
||||||
|
year: "numeric",
|
||||||
|
month: "numeric",
|
||||||
|
day: "numeric",
|
||||||
|
hour: "numeric",
|
||||||
|
minute: "numeric",
|
||||||
|
second: "numeric",
|
||||||
|
hourCycle: "h23"
|
||||||
|
};
|
||||||
|
|
||||||
const datetime1 = new Temporal.PlainDateTime(2021, 8, 4, 0, 30, 45, 123, 456, 789);
|
const datetime1 = new Temporal.PlainDateTime(2021, 8, 4, 0, 30, 45, 123, 456, 789);
|
||||||
const result1 = datetime1.toLocaleString("en", { timeZone: "Pacific/Apia" });
|
const result1 = datetime1.toLocaleString("en", options);
|
||||||
assert.sameValue(result1, "8/4/2021, 12:30:45 AM");
|
assert.sameValue(result1, "8/4/2021, 00:30:45");
|
||||||
|
|
||||||
const datetime2 = new Temporal.PlainDateTime(2021, 8, 4, 23, 30, 45, 123, 456, 789);
|
const datetime2 = new Temporal.PlainDateTime(2021, 8, 4, 23, 30, 45, 123, 456, 789);
|
||||||
const result2 = datetime2.toLocaleString("en", { timeZone: "Pacific/Apia" });
|
const result2 = datetime2.toLocaleString("en", options);
|
||||||
assert.sameValue(result2, "8/4/2021, 11:30:45 PM");
|
assert.sameValue(result2, "8/4/2021, 23:30:45");
|
||||||
|
@ -8,10 +8,20 @@ locale: [en]
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
// Using 24-hour clock to avoid format differences between Node 19 (which puts
|
||||||
|
// "\u{202f}" before AM/PM) and previous versions that use regular spaces.
|
||||||
|
const options = {
|
||||||
|
timeZone: "Pacific/Apia",
|
||||||
|
hour: "numeric",
|
||||||
|
minute: "numeric",
|
||||||
|
second: "numeric",
|
||||||
|
hourCycle: "h23"
|
||||||
|
};
|
||||||
|
|
||||||
const time1 = new Temporal.PlainTime(0, 30, 45, 123, 456, 789);
|
const time1 = new Temporal.PlainTime(0, 30, 45, 123, 456, 789);
|
||||||
const result1 = time1.toLocaleString("en", { timeZone: "Pacific/Apia" });
|
const result1 = time1.toLocaleString("en", options);
|
||||||
assert.sameValue(result1, "12:30:45 AM");
|
assert.sameValue(result1, "00:30:45");
|
||||||
|
|
||||||
const time2 = new Temporal.PlainTime(23, 30, 45, 123, 456, 789);
|
const time2 = new Temporal.PlainTime(23, 30, 45, 123, 456, 789);
|
||||||
const result2 = time2.toLocaleString("en", { timeZone: "Pacific/Apia" });
|
const result2 = time2.toLocaleString("en", options);
|
||||||
assert.sameValue(result2, "11:30:45 PM");
|
assert.sameValue(result2, "23:30:45");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user