Skip to content

Commit

Permalink
Temporal: Remove incorrect toLocaleString tests
Browse files Browse the repository at this point in the history
These staging tests are incorrect. See tc39/proposal-temporal#2795. This
was an unintended behaviour. It differed from the behaviour for dateStyle
and timeStyle, which was the intended behaviour.
  • Loading branch information
ptomato committed Oct 4, 2024
1 parent 0ef02cf commit 9ce31d2
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 35 deletions.
6 changes: 0 additions & 6 deletions test/staging/Intl402/Temporal/old/date-toLocaleString.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,3 @@ assert.sameValue(`${ date.toLocaleString("en-US", { timeZone: "America/New_York"
assert.sameValue(`${ date.toLocaleString("de-AT", { timeZone: "Europe/Vienna" }) }`, "18.11.1976");
var fmt = maybeGetWeekdayOnlyFormat();
if (fmt) assert.sameValue(fmt.format(date), "Thursday");

// should ignore units not in the data type
assert.sameValue(date.toLocaleString("en-US", { timeZoneName: "long" }), "11/18/1976");
assert.sameValue(date.toLocaleString("en-US", { hour: "numeric" }), "11/18/1976");
assert.sameValue(date.toLocaleString("en-US", { minute: "numeric" }), "11/18/1976");
assert.sameValue(date.toLocaleString("en-US", { second: "numeric" }), "11/18/1976");
6 changes: 0 additions & 6 deletions test/staging/Intl402/Temporal/old/datetime-toLocaleString.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ assert.sameValue(`${datetime.toLocaleString("de-AT", { timeZone: "Europe/Vienna"
var fmt = maybeGetWeekdayOnlyFormat();
if (fmt) assert.sameValue(fmt.format(datetime), "Thursday");

// should ignore units not in the data type
assert.sameValue(
datetime.toLocaleString("en-US", { timeZoneName: "long" }),
`11/18/1976, 3:23:30${usDayPeriodSpace}PM`
);

// should use compatible disambiguation option
var dstStart = new Temporal.PlainDateTime(2020, 3, 8, 2, 30);
assert.sameValue(
Expand Down
8 changes: 0 additions & 8 deletions test/staging/Intl402/Temporal/old/monthday-toLocaleString.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,3 @@ assert.sameValue(`${ monthday.toLocaleString("de-AT", {
timeZone: "Europe/Vienna",
calendar
}) }`, "18.11.");

// should ignore units not in the data type
assert.sameValue(monthday.toLocaleString("en-US", { timeZoneName: "long" }), "11/18");
assert.sameValue(monthday.toLocaleString("en-US", { year: "numeric" }), "11/18");
assert.sameValue(monthday.toLocaleString("en-US", { hour: "numeric" }), "11/18");
assert.sameValue(monthday.toLocaleString("en-US", { minute: "numeric" }), "11/18");
assert.sameValue(monthday.toLocaleString("en-US", { second: "numeric" }), "11/18");
assert.sameValue(monthday.toLocaleString("en-US", { weekday: "long" }), "11/18");
7 changes: 0 additions & 7 deletions test/staging/Intl402/Temporal/old/time-toLocaleString.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,3 @@ const usDayPeriodSpace =
var time = Temporal.PlainTime.from("1976-11-18T15:23:30");
assert.sameValue(`${time.toLocaleString("en-US", { timeZone: "America/New_York" })}`, `3:23:30${usDayPeriodSpace}PM`);
assert.sameValue(`${time.toLocaleString("de-AT", { timeZone: "Europe/Vienna" })}`, "15:23:30");

// should ignore units not in the data type
assert.sameValue(time.toLocaleString("en-US", { timeZoneName: "long" }), `3:23:30${usDayPeriodSpace}PM`);
assert.sameValue(time.toLocaleString("en-US", { year: "numeric" }), `3:23:30${usDayPeriodSpace}PM`);
assert.sameValue(time.toLocaleString("en-US", { month: "numeric" }), `3:23:30${usDayPeriodSpace}PM`);
assert.sameValue(time.toLocaleString("en-US", { day: "numeric" }), `3:23:30${usDayPeriodSpace}PM`);
assert.sameValue(time.toLocaleString("en-US", { weekday: "long" }), `3:23:30${usDayPeriodSpace}PM`);
8 changes: 0 additions & 8 deletions test/staging/Intl402/Temporal/old/yearmonth-toLocaleString.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,3 @@ assert.sameValue(
`${yearmonth.toLocaleString("de-AT", { timeZone: "Europe/Vienna", calendar })}`,
`11${deMonthYearSeparator}1976`
);

// should ignore units not in the data type
assert.sameValue(yearmonth.toLocaleString("en-US", { timeZoneName: "long" }), "11/1976");
assert.sameValue(yearmonth.toLocaleString("en-US", { day: "numeric" }), "11/1976");
assert.sameValue(yearmonth.toLocaleString("en-US", { hour: "numeric" }), "11/1976");
assert.sameValue(yearmonth.toLocaleString("en-US", { minute: "numeric" }), "11/1976");
assert.sameValue(yearmonth.toLocaleString("en-US", { second: "numeric" }), "11/1976");
assert.sameValue(yearmonth.toLocaleString("en-US", { weekday: "long" }), "11/1976");

0 comments on commit 9ce31d2

Please sign in to comment.