diff --git a/test/staging/Intl402/Temporal/old/date-toLocaleString.js b/test/staging/Intl402/Temporal/old/date-toLocaleString.js index 8a046815c4..282b22850e 100644 --- a/test/staging/Intl402/Temporal/old/date-toLocaleString.js +++ b/test/staging/Intl402/Temporal/old/date-toLocaleString.js @@ -21,16 +21,16 @@ function maybeGetWeekdayOnlyFormat() { } var date = Temporal.PlainDate.from("1976-11-18T15:23:30"); -assert.sameValue(`${ date.toLocaleString("en", { timeZone: "America/New_York" }) }`, "11/18/1976") -assert.sameValue(`${ date.toLocaleString("de", { timeZone: "Europe/Vienna" }) }`, "18.11.1976") +assert.sameValue(`${ date.toLocaleString("en-US", { timeZone: "America/New_York" }) }`, "11/18/1976"); +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", { timeZoneName: "long" }), "11/18/1976"); -assert.sameValue(date.toLocaleString("en", { hour: "numeric" }), "11/18/1976"); -assert.sameValue(date.toLocaleString("en", { minute: "numeric" }), "11/18/1976"); -assert.sameValue(date.toLocaleString("en", { second: "numeric" }), "11/18/1976"); +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"); // works when the object's calendar is the same as the locale's calendar var d = Temporal.PlainDate.from({ diff --git a/test/staging/Intl402/Temporal/old/datetime-toLocaleString.js b/test/staging/Intl402/Temporal/old/datetime-toLocaleString.js index 3d041f2c6a..ee88de87bc 100644 --- a/test/staging/Intl402/Temporal/old/datetime-toLocaleString.js +++ b/test/staging/Intl402/Temporal/old/datetime-toLocaleString.js @@ -8,7 +8,7 @@ features: [Temporal] ---*/ function maybeGetWeekdayOnlyFormat() { - const fmt = new Intl.DateTimeFormat("en", { weekday: "long", timeZone: "Europe/Vienna" }); + const fmt = new Intl.DateTimeFormat("en-US", { weekday: "long", timeZone: "Europe/Vienna" }); if ( ["era", "year", "month", "day", "hour", "minute", "second", "timeZoneName"].some( (prop) => prop in fmt.resolvedOptions() @@ -21,17 +21,17 @@ function maybeGetWeekdayOnlyFormat() { } var datetime = Temporal.PlainDateTime.from("1976-11-18T15:23:30"); -assert.sameValue(`${datetime.toLocaleString("en", { timeZone: "America/New_York" })}`, "11/18/1976, 3:23:30 PM"); -assert.sameValue(`${datetime.toLocaleString("de", { timeZone: "Europe/Vienna" })}`, "18.11.1976, 15:23:30"); +assert.sameValue(`${datetime.toLocaleString("en-US", { timeZone: "America/New_York" })}`, "11/18/1976, 3:23:30 PM"); +assert.sameValue(`${datetime.toLocaleString("de-AT", { timeZone: "Europe/Vienna" })}`, "18.11.1976, 15:23:30"); var fmt = maybeGetWeekdayOnlyFormat(); if (fmt) assert.sameValue(fmt.format(datetime), "Thursday"); // should ignore units not in the data type -assert.sameValue(datetime.toLocaleString("en", { timeZoneName: "long" }), "11/18/1976, 3:23:30 PM"); +assert.sameValue(datetime.toLocaleString("en-US", { timeZoneName: "long" }), "11/18/1976, 3:23:30 PM"); // should use compatible disambiguation option var dstStart = new Temporal.PlainDateTime(2020, 3, 8, 2, 30); -assert.sameValue(`${dstStart.toLocaleString("en", { timeZone: "America/Los_Angeles" })}`, "3/8/2020, 3:30:00 AM"); +assert.sameValue(`${dstStart.toLocaleString("en-US", { timeZone: "America/Los_Angeles" })}`, "3/8/2020, 3:30:00 AM"); // works when the object's calendar is the same as the locale's calendar var dt = Temporal.PlainDateTime.from({ diff --git a/test/staging/Intl402/Temporal/old/instant-toLocaleString.js b/test/staging/Intl402/Temporal/old/instant-toLocaleString.js index 07f4e3c889..d7b92c7998 100644 --- a/test/staging/Intl402/Temporal/old/instant-toLocaleString.js +++ b/test/staging/Intl402/Temporal/old/instant-toLocaleString.js @@ -8,7 +8,7 @@ features: [Temporal] ---*/ function maybeGetWeekdayOnlyFormat() { - const fmt = new Intl.DateTimeFormat("en", { weekday: "long", timeZone: "Europe/Vienna" }); + const fmt = new Intl.DateTimeFormat("en-US", { weekday: "long", timeZone: "Europe/Vienna" }); if ( ["era", "year", "month", "day", "hour", "minute", "second", "timeZoneName"].some( (prop) => prop in fmt.resolvedOptions() @@ -21,13 +21,13 @@ function maybeGetWeekdayOnlyFormat() { } var instant = Temporal.Instant.from("1976-11-18T14:23:30Z"); -assert.sameValue(`${instant.toLocaleString("en", { timeZone: "America/New_York" })}`, "11/18/1976, 9:23:30 AM"); -assert.sameValue(`${instant.toLocaleString("de", { timeZone: "Europe/Vienna" })}`, "18.11.1976, 15:23:30"); +assert.sameValue(`${instant.toLocaleString("en-US", { timeZone: "America/New_York" })}`, "11/18/1976, 9:23:30 AM"); +assert.sameValue(`${instant.toLocaleString("de-AT", { timeZone: "Europe/Vienna" })}`, "18.11.1976, 15:23:30"); var fmt = maybeGetWeekdayOnlyFormat(); if (fmt) assert.sameValue(fmt.format(instant), "Thursday"); // outputs timeZoneName if requested -var str = instant.toLocaleString("en", { +var str = instant.toLocaleString("en-US", { timeZone: "America/New_York", timeZoneName: "short" }); diff --git a/test/staging/Intl402/Temporal/old/monthday-toLocaleString.js b/test/staging/Intl402/Temporal/old/monthday-toLocaleString.js index 208b1ec6ef..d064ef2736 100644 --- a/test/staging/Intl402/Temporal/old/monthday-toLocaleString.js +++ b/test/staging/Intl402/Temporal/old/monthday-toLocaleString.js @@ -7,25 +7,25 @@ description: monthday.toLocaleString() features: [Temporal] ---*/ -var calendar = new Intl.DateTimeFormat("en").resolvedOptions().calendar; +var calendar = new Intl.DateTimeFormat("en-US").resolvedOptions().calendar; var monthday = Temporal.PlainMonthDay.from({ monthCode: "M11", day: 18, calendar }); -assert.sameValue(`${ monthday.toLocaleString("en", { timeZone: "America/New_York" }) }`, "11/18") -assert.sameValue(`${ monthday.toLocaleString("de", { +assert.sameValue(`${ monthday.toLocaleString("en-US", { timeZone: "America/New_York" }) }`, "11/18"); +assert.sameValue(`${ monthday.toLocaleString("de-AT", { timeZone: "Europe/Vienna", calendar -}) }`, "18.11.") +}) }`, "18.11."); // should ignore units not in the data type -assert.sameValue(monthday.toLocaleString("en", { timeZoneName: "long" }), "11/18"); -assert.sameValue(monthday.toLocaleString("en", { year: "numeric" }), "11/18"); -assert.sameValue(monthday.toLocaleString("en", { hour: "numeric" }), "11/18"); -assert.sameValue(monthday.toLocaleString("en", { minute: "numeric" }), "11/18"); -assert.sameValue(monthday.toLocaleString("en", { second: "numeric" }), "11/18"); -assert.sameValue(monthday.toLocaleString("en", { weekday: "long" }), "11/18"); +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"); // works when the object's calendar is the same as the locale's calendar var md = Temporal.PlainMonthDay.from({ diff --git a/test/staging/Intl402/Temporal/old/time-toLocaleString.js b/test/staging/Intl402/Temporal/old/time-toLocaleString.js index ff18d3d6e0..331dccc74f 100644 --- a/test/staging/Intl402/Temporal/old/time-toLocaleString.js +++ b/test/staging/Intl402/Temporal/old/time-toLocaleString.js @@ -8,12 +8,12 @@ features: [Temporal] ---*/ var time = Temporal.PlainTime.from("1976-11-18T15:23:30"); -assert.sameValue(`${time.toLocaleString("en", { timeZone: "America/New_York" })}`, "3:23:30 PM"); -assert.sameValue(`${time.toLocaleString("de", { timeZone: "Europe/Vienna" })}`, "15:23:30"); +assert.sameValue(`${time.toLocaleString("en-US", { timeZone: "America/New_York" })}`, "3:23:30 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", { timeZoneName: "long" }), "3:23:30 PM"); -assert.sameValue(time.toLocaleString("en", { year: "numeric" }), "3:23:30 PM"); -assert.sameValue(time.toLocaleString("en", { month: "numeric" }), "3:23:30 PM"); -assert.sameValue(time.toLocaleString("en", { day: "numeric" }), "3:23:30 PM"); -assert.sameValue(time.toLocaleString("en", { weekday: "long" }), "3:23:30 PM"); +assert.sameValue(time.toLocaleString("en-US", { timeZoneName: "long" }), "3:23:30 PM"); +assert.sameValue(time.toLocaleString("en-US", { year: "numeric" }), "3:23:30 PM"); +assert.sameValue(time.toLocaleString("en-US", { month: "numeric" }), "3:23:30 PM"); +assert.sameValue(time.toLocaleString("en-US", { day: "numeric" }), "3:23:30 PM"); +assert.sameValue(time.toLocaleString("en-US", { weekday: "long" }), "3:23:30 PM"); diff --git a/test/staging/Intl402/Temporal/old/yearmonth-toLocaleString.js b/test/staging/Intl402/Temporal/old/yearmonth-toLocaleString.js index fdc1c6d217..f9192ca4b2 100644 --- a/test/staging/Intl402/Temporal/old/yearmonth-toLocaleString.js +++ b/test/staging/Intl402/Temporal/old/yearmonth-toLocaleString.js @@ -7,15 +7,15 @@ description: yearmonth.toLocaleString() features: [Temporal] ---*/ -var calendar = new Intl.DateTimeFormat("en").resolvedOptions().calendar; +var calendar = new Intl.DateTimeFormat("en-US").resolvedOptions().calendar; var yearmonth = Temporal.PlainYearMonth.from({ year: 1976, month: 11, calendar }); -assert.sameValue(`${yearmonth.toLocaleString("en", { timeZone: "America/New_York" })}`, "11/1976"); +assert.sameValue(`${yearmonth.toLocaleString("en-US", { timeZone: "America/New_York" })}`, "11/1976"); assert.sameValue( - `${yearmonth.toLocaleString("de", { + `${yearmonth.toLocaleString("de-AT", { timeZone: "Europe/Vienna", calendar })}`, @@ -23,12 +23,12 @@ assert.sameValue( ); // should ignore units not in the data type -assert.sameValue(yearmonth.toLocaleString("en", { timeZoneName: "long" }), "11/1976"); -assert.sameValue(yearmonth.toLocaleString("en", { day: "numeric" }), "11/1976"); -assert.sameValue(yearmonth.toLocaleString("en", { hour: "numeric" }), "11/1976"); -assert.sameValue(yearmonth.toLocaleString("en", { minute: "numeric" }), "11/1976"); -assert.sameValue(yearmonth.toLocaleString("en", { second: "numeric" }), "11/1976"); -assert.sameValue(yearmonth.toLocaleString("en", { weekday: "long" }), "11/1976"); +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"); // works when the object's calendar is the same as the locale's calendar var ym = Temporal.PlainYearMonth.from({ diff --git a/test/staging/Intl402/Temporal/old/zoneddatetime-toLocaleString.js b/test/staging/Intl402/Temporal/old/zoneddatetime-toLocaleString.js index 6fe83aca53..39d6fea936 100644 --- a/test/staging/Intl402/Temporal/old/zoneddatetime-toLocaleString.js +++ b/test/staging/Intl402/Temporal/old/zoneddatetime-toLocaleString.js @@ -8,7 +8,7 @@ features: [Temporal] ---*/ function maybeGetWeekdayOnlyFormat() { - const fmt = new Intl.DateTimeFormat("en", { weekday: "long", timeZone: "Europe/Vienna" }); + const fmt = new Intl.DateTimeFormat("en-US", { weekday: "long", timeZone: "Europe/Vienna" }); if ( ["era", "year", "month", "day", "hour", "minute", "second", "timeZoneName"].some( (prop) => prop in fmt.resolvedOptions() @@ -21,23 +21,23 @@ function maybeGetWeekdayOnlyFormat() { } var zdt = Temporal.ZonedDateTime.from("1976-11-18T15:23:30+01:00[Europe/Vienna]"); -assert.sameValue(zdt.toLocaleString("en"), "11/18/1976, 3:23:30 PM GMT+1"); -assert.sameValue(zdt.toLocaleString("de"), "18.11.1976, 15:23:30 MEZ"); +assert.sameValue(zdt.toLocaleString("en-US"), "11/18/1976, 3:23:30 PM GMT+1"); +assert.sameValue(zdt.toLocaleString("de-AT"), "18.11.1976, 15:23:30 MEZ"); const fmt = maybeGetWeekdayOnlyFormat(); // uses only the options in resolvedOptions if (fmt) assert.sameValue(fmt.format(zdt), "Thursday"); // can override the style of the time zone name assert.sameValue( - zdt.toLocaleString("en", { timeZoneName: "long" }), + zdt.toLocaleString("en-US", { timeZoneName: "long" }), "11/18/1976, 3:23:30 PM Central European Standard Time" ); // works if the time zone given in options agrees with the object's time zone -assert.sameValue(zdt.toLocaleString("en", { timeZone: "Europe/Vienna" }), "11/18/1976, 3:23:30 PM GMT+1"); +assert.sameValue(zdt.toLocaleString("en-US", { timeZone: "Europe/Vienna" }), "11/18/1976, 3:23:30 PM GMT+1"); // throws if the time zone given in options disagrees with the object's time zone -assert.throws(RangeError, () => zdt.toLocaleString("en", { timeZone: "America/New_York" })); +assert.throws(RangeError, () => zdt.toLocaleString("en-US", { timeZone: "America/New_York" })); // works when the object's calendar is the same as the locale's calendar var zdt = new Temporal.ZonedDateTime(0n, "UTC", "japanese");