From efc7424844ee9219e52036c68d018b6d8ee18a69 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 4 Jun 2024 17:35:22 +0200 Subject: [PATCH] Temporal: Don't use getISOFields() in other tests Previously getISOFields() was used to get the exact value of the [[Calendar]] and [[TimeZone]] internal slots, as well as to get the reference ISO year for PlainMonthDay and reference ISO day for PlainYearMonth. Use calendarId and timeZoneId for the former and toString() for the latter. --- harness/temporalHelpers.js | 14 +++++---- .../toZonedDateTimeISO/calendar-is-builtin.js | 2 +- .../toZonedDateTimeISO/timezone-string.js | 3 +- .../Temporal/Now/plainDateISO/return-value.js | 2 +- .../plainDateTimeISO/return-value-calendar.js | 2 +- .../Now/zonedDateTimeISO/return-value.js | 5 ++- .../zonedDateTimeISO/time-zone-undefined.js | 5 ++- .../Now/zonedDateTimeISO/timezone-string.js | 3 +- test/built-ins/Temporal/PlainDate/basic.js | 2 +- .../Temporal/PlainDate/calendar-string.js | 2 +- .../Temporal/PlainDate/calendar-undefined.js | 4 +-- .../PlainDate/from/argument-plaindate.js | 2 +- ...rgument-propertybag-calendar-iso-string.js | 2 +- .../argument-propertybag-calendar-string.js | 2 +- .../from/argument-propertybag-calendar.js | 2 +- .../PlainDate/from/argument-zoneddatetime.js | 2 +- .../prototype/toPlainMonthDay/basic.js | 2 +- .../prototype/toPlainYearMonth/basic.js | 2 +- .../toZonedDateTime/timezone-string.js | 3 +- .../PlainDate/prototype/withCalendar/basic.js | 2 +- .../withCalendar/calendar-iso-string.js | 2 +- .../prototype/withCalendar/calendar-string.js | 2 +- .../withCalendar/calendar-temporal-object.js | 4 +-- .../withCalendar/subclassing-ignored.js | 2 +- .../Temporal/PlainDateTime/calendar-string.js | 2 +- .../PlainDateTime/constructor-full.js | 2 +- .../PlainDateTime/from/argument-plaindate.js | 2 +- .../from/argument-plaindatetime.js | 2 +- ...rgument-propertybag-calendar-iso-string.js | 2 +- .../argument-propertybag-calendar-string.js | 2 +- .../from/calendar-temporal-object.js | 2 +- .../toZonedDateTime/timezone-string.js | 3 +- .../prototype/withCalendar/basic.js | 2 +- .../withCalendar/calendar-iso-string.js | 2 +- .../prototype/withCalendar/calendar-string.js | 2 +- .../withCalendar/calendar-temporal-object.js | 4 +-- .../Temporal/PlainMonthDay/calendar-string.js | 2 +- .../from/argument-plainmonthday.js | 2 +- ...rgument-propertybag-calendar-iso-string.js | 2 +- .../argument-propertybag-calendar-string.js | 2 +- .../from/calendar-temporal-object.js | 2 +- .../PlainMonthDay/refisoyear-undefined.js | 6 ++-- .../PlainYearMonth/calendar-string.js | 2 +- .../PlainYearMonth/from/argument-plaindate.js | 7 ++--- .../from/argument-plainyearmonth.js | 2 +- ...rgument-propertybag-calendar-iso-string.js | 2 +- .../argument-propertybag-calendar-string.js | 2 +- .../PlainYearMonth/from/argument-string.js | 15 +++------ .../from/calendar-temporal-object.js | 2 +- .../PlainYearMonth/prototype/with/basic.js | 4 +-- .../PlainYearMonth/refisoday-undefined.js | 6 ++-- .../Temporal/ZonedDateTime/calendar-string.js | 2 +- .../ZonedDateTime/calendar-undefined.js | 4 +-- ...rgument-propertybag-calendar-iso-string.js | 2 +- .../argument-propertybag-calendar-string.js | 2 +- .../argument-propertybag-timezone-string.js | 3 +- .../from/argument-zoneddatetime.js | 2 +- .../from/calendar-temporal-object.js | 2 +- .../withCalendar/calendar-iso-string.js | 2 +- .../prototype/withCalendar/calendar-string.js | 2 +- .../withCalendar/calendar-temporal-object.js | 4 +-- .../withCalendar/subclassing-ignored.js | 2 +- .../prototype/withTimeZone/timezone-string.js | 3 +- .../Temporal/ZonedDateTime/timezone-string.js | 2 +- .../Now/zonedDateTimeISO/timezone-string.js | 2 -- .../prototype/withCalendar/argument-string.js | 6 +--- .../PlainMonthDay/from/reference-year-1972.js | 3 +- .../from/reference-day-chinese.js | 5 ++- .../from/reference-day-hebrew.js | 5 ++- .../Intl402/Temporal/old/islamic-calendars.js | 27 +++++----------- .../Intl402/Temporal/old/persian-calendar.js | 31 +++++-------------- .../Temporal/ZonedDateTime/old/toPlainDate.js | 2 +- .../ZonedDateTime/old/withCalendar.js | 2 +- .../ZonedDateTime/old/withTimezone.js | 2 +- 74 files changed, 110 insertions(+), 165 deletions(-) diff --git a/harness/temporalHelpers.js b/harness/temporalHelpers.js index 39017c84f8..d7860f3573 100644 --- a/harness/temporalHelpers.js +++ b/harness/temporalHelpers.js @@ -178,8 +178,8 @@ var TemporalHelpers = { assert(actual instanceof Temporal.PlainDateTime, `${prefix}instanceof`); assert(actual.equals(expected), `${prefix}equals method`); assert.sameValue( - actual.getISOFields().calendar, - expected.getISOFields().calendar, + actual.calendarId, + expected.calendarId, `${prefix}calendar same value:` ); }, @@ -197,7 +197,8 @@ var TemporalHelpers = { assert(monthDay instanceof Temporal.PlainMonthDay, `${prefix}instanceof`); assert.sameValue(monthDay.monthCode, monthCode, `${prefix}monthCode result:`); assert.sameValue(monthDay.day, day, `${prefix}day result:`); - assert.sameValue(monthDay.getISOFields().isoYear, referenceISOYear, `${prefix}referenceISOYear result:`); + const isoYear = Number(monthDay.toString({ calendarName: "always" }).split("-")[0]); + assert.sameValue(isoYear, referenceISOYear, `${prefix}referenceISOYear result:`); }, /* @@ -246,7 +247,8 @@ var TemporalHelpers = { assert.sameValue(yearMonth.year, year, `${prefix}year result:`); assert.sameValue(yearMonth.month, month, `${prefix}month result:`); assert.sameValue(yearMonth.monthCode, monthCode, `${prefix}monthCode result:`); - assert.sameValue(yearMonth.getISOFields().isoDay, referenceISODay, `${prefix}referenceISODay result:`); + const isoDay = Number(yearMonth.toString({ calendarName: "always" }).slice(1).split('-')[2].slice(0, 2)); + assert.sameValue(isoDay, referenceISODay, `${prefix}referenceISODay result:`); }, /* @@ -263,8 +265,8 @@ var TemporalHelpers = { assert(actual.equals(expected), `${prefix}equals method`); assert.sameValue(actual.timeZone, expected.timeZone, `${prefix}time zone same value:`); assert.sameValue( - actual.getISOFields().calendar, - expected.getISOFields().calendar, + actual.calendarId, + expected.calendarId, `${prefix}calendar same value:` ); }, diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/calendar-is-builtin.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/calendar-is-builtin.js index 662eaedb35..47bad974a2 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/calendar-is-builtin.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/calendar-is-builtin.js @@ -10,4 +10,4 @@ features: [Temporal] const instance = new Temporal.Instant(0n); const result = instance.toZonedDateTimeISO("UTC"); -assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); +assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string.js index 236cb0688d..687a637791 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string.js @@ -4,7 +4,6 @@ /*--- esid: sec-temporal.instant.prototype.tozoneddatetimeiso description: Time zone IDs are valid input for a time zone -includes: [temporalHelpers.js] features: [Temporal] ---*/ @@ -12,5 +11,5 @@ const instance = new Temporal.Instant(0n); ["UTC", "+01:30"].forEach((timeZone) => { const result = instance.toZonedDateTimeISO(timeZone); - assert.sameValue(result.getISOFields().timeZone, timeZone, `time zone slot should store string "${timeZone}"`); + assert.sameValue(result.timeZoneId, timeZone, `time zone slot should store string "${timeZone}"`); }); diff --git a/test/built-ins/Temporal/Now/plainDateISO/return-value.js b/test/built-ins/Temporal/Now/plainDateISO/return-value.js index 511e51f769..0ecd9f8d92 100644 --- a/test/built-ins/Temporal/Now/plainDateISO/return-value.js +++ b/test/built-ins/Temporal/Now/plainDateISO/return-value.js @@ -9,4 +9,4 @@ features: [Temporal] const d = Temporal.Now.plainDateISO(); assert(d instanceof Temporal.PlainDate); -assert.sameValue(d.getISOFields().calendar, "iso8601", "calendar slot should store a string"); +assert.sameValue(d.calendarId, "iso8601", "calendar string should be iso8601"); diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/return-value-calendar.js b/test/built-ins/Temporal/Now/plainDateTimeISO/return-value-calendar.js index 073856d8ee..bf1a35ea22 100644 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/return-value-calendar.js +++ b/test/built-ins/Temporal/Now/plainDateTimeISO/return-value-calendar.js @@ -8,4 +8,4 @@ features: [Temporal] ---*/ const result = Temporal.Now.plainDateTimeISO(); -assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot should store a string"); +assert.sameValue(result.calendarId, "iso8601", "calendar string should be iso8601"); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/return-value.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/return-value.js index 5e8bd4ceb2..9802420c57 100644 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/return-value.js +++ b/test/built-ins/Temporal/Now/zonedDateTimeISO/return-value.js @@ -8,7 +8,6 @@ features: [Temporal] ---*/ const zdt = Temporal.Now.zonedDateTimeISO(); -const tz = Temporal.Now.timeZoneId(); assert(zdt instanceof Temporal.ZonedDateTime); -assert.sameValue(zdt.getISOFields().calendar, "iso8601", "calendar slot should store a string"); -assert.sameValue(zdt.getISOFields().timeZone, tz, "time zone slot should store a string"); +assert.sameValue(zdt.calendarId, "iso8601", "calendar string should be iso8601"); +assert.sameValue(zdt.timeZoneId, Temporal.Now.timeZoneId(), "time zone string should be the same as from Now"); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/time-zone-undefined.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/time-zone-undefined.js index e0b6bae3e0..4bed14e13e 100644 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/time-zone-undefined.js +++ b/test/built-ins/Temporal/Now/zonedDateTimeISO/time-zone-undefined.js @@ -4,14 +4,13 @@ /*--- esid: sec-temporal.now.zoneddatetimeiso description: Functions when time zone argument is omitted -includes: [compareArray.js] features: [Temporal] ---*/ const systemTimeZone = Temporal.Now.timeZoneId(); const resultExplicit = Temporal.Now.zonedDateTimeISO(undefined); -assert.sameValue(resultExplicit.getISOFields().timeZone, systemTimeZone, "time zone slot should store a string"); +assert.sameValue(resultExplicit.timeZoneId, systemTimeZone, "time zone string should be the system time zone"); const resultImplicit = Temporal.Now.zonedDateTimeISO(); -assert.sameValue(resultImplicit.getISOFields().timeZone, systemTimeZone, "time zone slot should store a string"); +assert.sameValue(resultImplicit.timeZoneId, systemTimeZone, "time zone string should be the system time zone"); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string.js index 9a27fad073..1f74bb6ec1 100644 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string.js +++ b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string.js @@ -4,11 +4,10 @@ /*--- esid: sec-temporal.now.zoneddatetimeiso description: Time zone IDs are valid input for a time zone -includes: [temporalHelpers.js] features: [Temporal] ---*/ ["UTC", "+01:30"].forEach((timeZone) => { const result = Temporal.Now.zonedDateTimeISO(timeZone); - assert.sameValue(result.getISOFields().timeZone, timeZone, `Time zone created from string "${timeZone}"`); + assert.sameValue(result.timeZoneId, timeZone, `Time zone created from string "${timeZone}"`); }); diff --git a/test/built-ins/Temporal/PlainDate/basic.js b/test/built-ins/Temporal/PlainDate/basic.js index a01a726e9c..9868ad38ea 100644 --- a/test/built-ins/Temporal/PlainDate/basic.js +++ b/test/built-ins/Temporal/PlainDate/basic.js @@ -10,4 +10,4 @@ features: [Temporal] const plainDate = new Temporal.PlainDate(2020, 12, 24, "iso8601"); TemporalHelpers.assertPlainDate(plainDate, 2020, 12, "M12", 24, "with string"); -assert.sameValue(plainDate.getISOFields().calendar, "iso8601", "calendar slot should store a string"); +assert.sameValue(plainDate.calendarId, "iso8601", "calendar string is iso8601"); diff --git a/test/built-ins/Temporal/PlainDate/calendar-string.js b/test/built-ins/Temporal/PlainDate/calendar-string.js index 228b6e9489..c67c3e3f6c 100644 --- a/test/built-ins/Temporal/PlainDate/calendar-string.js +++ b/test/built-ins/Temporal/PlainDate/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = new Temporal.PlainDate(2000, 5, 2, arg); -assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDate/calendar-undefined.js b/test/built-ins/Temporal/PlainDate/calendar-undefined.js index 68d2fe8251..a8b135d318 100644 --- a/test/built-ins/Temporal/PlainDate/calendar-undefined.js +++ b/test/built-ins/Temporal/PlainDate/calendar-undefined.js @@ -10,7 +10,7 @@ features: [Temporal] const args = [2020, 12, 24]; const dateExplicit = new Temporal.PlainDate(...args, undefined); -assert.sameValue(dateExplicit.getISOFields().calendar, "iso8601", "calendar slot should store string"); +assert.sameValue(dateExplicit.calendarId, "iso8601", "calendar string is iso8601"); const dateImplicit = new Temporal.PlainDate(...args); -assert.sameValue(dateImplicit.getISOFields().calendar, "iso8601", "calendar slot should store string"); +assert.sameValue(dateImplicit.calendarId, "iso8601", "calendar string is iso8601"); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-plaindate.js b/test/built-ins/Temporal/PlainDate/from/argument-plaindate.js index e0ac9111e0..2aada085b0 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-plaindate.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-plaindate.js @@ -17,7 +17,7 @@ TemporalHelpers.assertPlainDate( "PlainDate is copied" ); -assert.sameValue(result.getISOFields().calendar, orig.getISOFields().calendar, "Calendar is copied"); +assert.sameValue(result.calendarId, orig.calendarId, "Calendar is copied"); assert.notSameValue( result, diff --git a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-iso-string.js b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-iso-string.js index 0b02a97509..1b8830688a 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-iso-string.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-iso-string.js @@ -21,5 +21,5 @@ for (const calendar of [ const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; const result = Temporal.PlainDate.from(arg); TemporalHelpers.assertPlainDate(result, 1976, 11, "M11", 18, `Calendar created from string "${calendar}"`); - assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); + assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); } diff --git a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-string.js index 72bea4c95a..c8075d64b9 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-string.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-string.js @@ -13,4 +13,4 @@ const calendar = "iso8601"; const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; const result = Temporal.PlainDate.from(arg); TemporalHelpers.assertPlainDate(result, 1976, 11, "M11", 18, `Calendar created from string "${calendar}"`); -assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); +assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar.js b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar.js index 618bbfb15d..73ad36b820 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar.js @@ -11,4 +11,4 @@ features: [Temporal] const calendar = "iso8601"; const plainDate = Temporal.PlainDate.from({ year: 1976, month: 11, day: 18, calendar }); TemporalHelpers.assertPlainDate(plainDate, 1976, 11, "M11", 18); -assert.sameValue(plainDate.getISOFields().calendar, "iso8601", "calendar slot should store a string"); +assert.sameValue(plainDate.calendarId, "iso8601", "calendar string is iso8601"); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-zoneddatetime.js b/test/built-ins/Temporal/PlainDate/from/argument-zoneddatetime.js index 3caa472f66..8ae3cf5989 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-zoneddatetime.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-zoneddatetime.js @@ -19,7 +19,7 @@ TemporalHelpers.assertPlainDate( ); assert.sameValue( - result.getISOFields().calendar, + result.calendarId, calendar, "Calendar is copied" ); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/basic.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/basic.js index 219942a325..9f5bc2f452 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/basic.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/basic.js @@ -11,4 +11,4 @@ features: [Temporal] const pd = new Temporal.PlainDate(1970, 12, 24, "iso8601"); const pmd = pd.toPlainMonthDay(); TemporalHelpers.assertPlainMonthDay(pmd, "M12", 24); -assert.sameValue(pmd.getISOFields().calendar, "iso8601"); +assert.sameValue(pmd.calendarId, "iso8601"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/basic.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/basic.js index 01c41f225f..4ddc1d25e4 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/basic.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/basic.js @@ -11,4 +11,4 @@ features: [Temporal] const pd = new Temporal.PlainDate(1970, 12, 24, "iso8601"); const pym = pd.toPlainYearMonth(); TemporalHelpers.assertPlainYearMonth(pym, 1970, 12, "M12"); -assert.sameValue(pym.getISOFields().calendar, "iso8601"); +assert.sameValue(pym.calendarId, "iso8601"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string.js index dc93a41d33..850a0d43ed 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string.js @@ -4,7 +4,6 @@ /*--- esid: sec-temporal.plaindate.prototype.tozoneddatetime description: Time zone IDs are valid input for a time zone -includes: [temporalHelpers.js] features: [Temporal] ---*/ @@ -12,5 +11,5 @@ const instance = new Temporal.PlainDate(2000, 5, 2); ["UTC", "+01:30"].forEach((timeZone) => { const result = instance.toZonedDateTime(timeZone); - assert.sameValue(result.getISOFields().timeZone, timeZone, `time zone slot should store string "${timeZone}"`); + assert.sameValue(result.timeZoneId, timeZone, `time zone slot should store string "${timeZone}"`); }); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/basic.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/basic.js index cabe8538d2..e28b904673 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/basic.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/basic.js @@ -14,4 +14,4 @@ const calendar = "iso8601"; const stringResult = plainDate.withCalendar("iso8601"); assert.notSameValue(stringResult, plainDate, "string: new object"); TemporalHelpers.assertPlainDate(stringResult, 1976, 11, "M11", 18, "string"); -assert.sameValue(stringResult.getISOFields().calendar, "iso8601", "string: calendar slot stores a string"); +assert.sameValue(stringResult.calendarId, "iso8601", "string: calendar is iso8601"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-iso-string.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-iso-string.js index c9afdf80c9..b13cbcfdc4 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-iso-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-iso-string.js @@ -20,5 +20,5 @@ for (const arg of [ "2020-01[u-ca=iso8601]", ]) { const result = instance.withCalendar(arg); - assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); + assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); } diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js index a252f2ebc3..90095e884f 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js @@ -12,4 +12,4 @@ const instance = new Temporal.PlainDate(1976, 11, 18, "iso8601"); const arg = "iso8601"; const result = instance.withCalendar(arg); -assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js index 4cb7bd1e99..43d2ed729e 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js @@ -24,8 +24,6 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const actual = []; const expected = []; - const calendar = arg.getISOFields().calendar; - Object.defineProperty(arg, "calendar", { get() { actual.push("get calendar"); @@ -35,7 +33,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const instance = new Temporal.PlainDate(1976, 11, 18, "iso8601"); const result = instance.withCalendar(arg); - assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.calendarId, "iso8601", "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js index e237dcbb98..4f763912e8 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js @@ -15,6 +15,6 @@ TemporalHelpers.checkSubclassingIgnored( ["iso8601"], (result) => { TemporalHelpers.assertPlainDate(result, 2000, 5, "M05", 2); - assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar result"); + assert.sameValue(result.calendarId, "iso8601", "calendar result"); }, ); diff --git a/test/built-ins/Temporal/PlainDateTime/calendar-string.js b/test/built-ins/Temporal/PlainDateTime/calendar-string.js index 450c24c3a5..d1e4f9331d 100644 --- a/test/built-ins/Temporal/PlainDateTime/calendar-string.js +++ b/test/built-ins/Temporal/PlainDateTime/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = new Temporal.PlainDateTime(2000, 5, 2, 15, 23, 30, 987, 654, 321, arg); -assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/constructor-full.js b/test/built-ins/Temporal/PlainDateTime/constructor-full.js index ac549099a9..2f9cb153cd 100644 --- a/test/built-ins/Temporal/PlainDateTime/constructor-full.js +++ b/test/built-ins/Temporal/PlainDateTime/constructor-full.js @@ -16,7 +16,7 @@ TemporalHelpers.assertPlainDateTime(datetime, ); assert.sameValue( - datetime.getISOFields().calendar, + datetime.calendarId, "iso8601", "calendar supplied in constructor can be extracted and is unchanged" ); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-plaindate.js b/test/built-ins/Temporal/PlainDateTime/from/argument-plaindate.js index 4ec2770325..e38fc4f742 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/argument-plaindate.js +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-plaindate.js @@ -17,5 +17,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalPlainDateTimeFastPath((date) => { const result = Temporal.PlainDateTime.from(date); TemporalHelpers.assertPlainDateTime(result, 2000, 5, "M05", 2, 0, 0, 0, 0, 0, 0, "midnight is assumed"); - assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar result"); + assert.sameValue(result.calendarId, "iso8601", "calendar result"); }); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-plaindatetime.js b/test/built-ins/Temporal/PlainDateTime/from/argument-plaindatetime.js index ea0a21bf23..6b3db78c0a 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/argument-plaindatetime.js +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-plaindatetime.js @@ -17,7 +17,7 @@ TemporalHelpers.assertPlainDateTime( "PlainDateTime is copied" ); -assert.sameValue(result.getISOFields().calendar, orig.getISOFields().calendar, "Calendar is copied"); +assert.sameValue(result.calendarId, orig.calendarId, "Calendar is copied"); assert.notSameValue( result, diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-iso-string.js b/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-iso-string.js index 46bf466c9e..cb54d4f983 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-iso-string.js +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-iso-string.js @@ -21,5 +21,5 @@ for (const calendar of [ const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; const result = Temporal.PlainDateTime.from(arg); TemporalHelpers.assertPlainDateTime(result, 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); - assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); + assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); } diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-string.js index 70ff0507f6..9b8617afc4 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-string.js +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-string.js @@ -13,4 +13,4 @@ const calendar = "iso8601"; const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; const result = Temporal.PlainDateTime.from(arg); TemporalHelpers.assertPlainDateTime(result, 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); -assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); +assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); diff --git a/test/built-ins/Temporal/PlainDateTime/from/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDateTime/from/calendar-temporal-object.js index 7704743ad0..fc66891a05 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDateTime/from/calendar-temporal-object.js @@ -22,5 +22,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject) => { const result = Temporal.PlainDateTime.from({ year: 2000, month: 5, day: 2, calendar: temporalObject }); - assert.sameValue(result.getISOFields().calendar, "iso8601", "Temporal object coerced to calendar"); + assert.sameValue(result.calendarId, "iso8601", "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string.js index 0d4fb9e4d8..c5c2300e52 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string.js @@ -4,7 +4,6 @@ /*--- esid: sec-temporal.plaindatetime.prototype.tozoneddatetime description: Time zone IDs are valid input for a time zone -includes: [temporalHelpers.js] features: [Temporal] ---*/ @@ -12,5 +11,5 @@ const instance = new Temporal.PlainDateTime(2000, 5, 2); ["UTC", "+01:30"].forEach((timeZone) => { const result = instance.toZonedDateTime(timeZone); - assert.sameValue(result.getISOFields().timeZone, timeZone, `time zone slot should store string "${timeZone}"`); + assert.sameValue(result.timeZoneId, timeZone, `time zone slot should store string "${timeZone}"`); }); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/basic.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/basic.js index ad23448fb5..7ba356d3c6 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/basic.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/basic.js @@ -19,4 +19,4 @@ TemporalHelpers.assertPlainDateTime( "works" ); -assert.sameValue(result.getISOFields().calendar, calendar, "underlying calendar is unchanged"); +assert.sameValue(result.calendarId, calendar, "underlying calendar is unchanged"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-iso-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-iso-string.js index a77767ec39..6f5524a0d8 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-iso-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-iso-string.js @@ -20,5 +20,5 @@ for (const arg of [ "2020-01[u-ca=iso8601]", ]) { const result = instance.withCalendar(arg); - assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); + assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); } diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js index 60d17cda7c..39abb85852 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js @@ -12,4 +12,4 @@ const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, const arg = "iso8601"; const result = instance.withCalendar(arg); -assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js index baae132bb8..0118d0510d 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js @@ -24,8 +24,6 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const actual = []; const expected = []; - const calendar = arg.getISOFields().calendar; - Object.defineProperty(arg, "calendar", { get() { actual.push("get calendar"); @@ -35,7 +33,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, "iso8601"); const result = instance.withCalendar(arg); - assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.calendarId, "iso8601", "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/PlainMonthDay/calendar-string.js b/test/built-ins/Temporal/PlainMonthDay/calendar-string.js index 222645121f..110c7d4d4e 100644 --- a/test/built-ins/Temporal/PlainMonthDay/calendar-string.js +++ b/test/built-ins/Temporal/PlainMonthDay/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = new Temporal.PlainMonthDay(12, 15, arg, 1972); -assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-plainmonthday.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-plainmonthday.js index 760ae71fd1..35c862ccc9 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/argument-plainmonthday.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-plainmonthday.js @@ -18,7 +18,7 @@ TemporalHelpers.assertPlainMonthDay( /* isoYear = */ 2000 ); -assert.sameValue(result.getISOFields().calendar, orig.getISOFields().calendar, "Calendar is copied"); +assert.sameValue(result.calendarId, orig.calendarId, "Calendar is copied"); assert.notSameValue( result, diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-iso-string.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-iso-string.js index d19bf877cc..249d41f1ff 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-iso-string.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-iso-string.js @@ -21,5 +21,5 @@ for (const calendar of [ const arg = { monthCode: "M11", day: 18, calendar }; const result = Temporal.PlainMonthDay.from(arg); TemporalHelpers.assertPlainMonthDay(result, "M11", 18, `Calendar created from string "${calendar}"`); - assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); + assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); } diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-string.js index f1357d0c67..12e37f53af 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-string.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-string.js @@ -13,4 +13,4 @@ const calendar = "iso8601"; const arg = { monthCode: "M11", day: 18, calendar }; const result = Temporal.PlainMonthDay.from(arg); TemporalHelpers.assertPlainMonthDay(result, "M11", 18, `Calendar created from string "${calendar}"`); -assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); +assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/calendar-temporal-object.js b/test/built-ins/Temporal/PlainMonthDay/from/calendar-temporal-object.js index e8c19fedd9..be2904b358 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/calendar-temporal-object.js @@ -22,5 +22,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject) => { const result = Temporal.PlainMonthDay.from({ monthCode: "M05", day: 2, calendar: temporalObject }); - assert.sameValue(result.getISOFields().calendar, "iso8601", "Temporal object coerced to calendar"); + assert.sameValue(result.calendarId, "iso8601", "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/PlainMonthDay/refisoyear-undefined.js b/test/built-ins/Temporal/PlainMonthDay/refisoyear-undefined.js index 062d7d3622..d819b57df9 100644 --- a/test/built-ins/Temporal/PlainMonthDay/refisoyear-undefined.js +++ b/test/built-ins/Temporal/PlainMonthDay/refisoyear-undefined.js @@ -10,7 +10,9 @@ features: [Temporal] const args = [5, 2, "iso8601"]; const dateExplicit = new Temporal.PlainMonthDay(...args, undefined); -assert.sameValue(dateExplicit.getISOFields().isoYear, 1972, "default referenceISOYear is 1972"); +const isoYearExplicit = Number(dateExplicit.toString({ calendarName: "always" }).slice(0, 4)); +assert.sameValue(isoYearExplicit, 1972, "default referenceISOYear is 1972"); const dateImplicit = new Temporal.PlainMonthDay(...args); -assert.sameValue(dateImplicit.getISOFields().isoYear, 1972, "default referenceISOYear is 1972"); +const isoYearImplicit = Number(dateImplicit.toString({ calendarName: "always" }).slice(0, 4)); +assert.sameValue(isoYearImplicit, 1972, "default referenceISOYear is 1972"); diff --git a/test/built-ins/Temporal/PlainYearMonth/calendar-string.js b/test/built-ins/Temporal/PlainYearMonth/calendar-string.js index d9f558955c..31f26cea53 100644 --- a/test/built-ins/Temporal/PlainYearMonth/calendar-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = new Temporal.PlainYearMonth(2000, 5, arg, 1); -assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-plaindate.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-plaindate.js index 9923c808eb..e9784ce21b 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/argument-plaindate.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-plaindate.js @@ -11,8 +11,5 @@ features: [Temporal] const plainDate = Temporal.PlainDate.from("1976-11-18"); const plainYearMonth = Temporal.PlainYearMonth.from(plainDate); TemporalHelpers.assertPlainYearMonth(plainYearMonth, 1976, 11, "M11"); -const fields = plainYearMonth.getISOFields(); -assert.sameValue(fields.calendar, "iso8601", "calendar slot should store a string"); -assert.sameValue(fields.isoDay, 1, "isoDay"); -assert.sameValue(fields.isoMonth, 11, "isoMonth"); -assert.sameValue(fields.isoYear, 1976, "isoYear"); +assert.sameValue(plainYearMonth.calendarId, "iso8601", "calendar string should be iso8601"); +assert.sameValue(plainYearMonth.toString({ calendarName: "always" }), "1976-11-01[u-ca=iso8601]", "iso reference date"); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-plainyearmonth.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-plainyearmonth.js index 9dd8f55b37..fa59a100fa 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/argument-plainyearmonth.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-plainyearmonth.js @@ -18,7 +18,7 @@ TemporalHelpers.assertPlainYearMonth( /* era = */ undefined, /* eraYear = */ undefined, /* isoDay = */ 7 ); -assert.sameValue(result.getISOFields().calendar, orig.getISOFields().calendar, "Calendar is copied"); +assert.sameValue(result.calendarId, orig.calendarId, "Calendar is copied"); assert.notSameValue( result, diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-iso-string.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-iso-string.js index 152900e85f..026be305bb 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-iso-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-iso-string.js @@ -21,5 +21,5 @@ for (const calendar of [ const arg = { year: 2019, monthCode: "M06", calendar }; const result = Temporal.PlainYearMonth.from(arg); TemporalHelpers.assertPlainYearMonth(result, 2019, 6, "M06", `Calendar created from string "${calendar}"`); - assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); + assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); } diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-string.js index a98c2b5567..24ac2ac93e 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-string.js @@ -13,4 +13,4 @@ const calendar = "iso8601"; const arg = { year: 2019, monthCode: "M06", calendar }; const result = Temporal.PlainYearMonth.from(arg); TemporalHelpers.assertPlainYearMonth(result, 2019, 6, "M06", `Calendar created from string "${calendar}"`); -assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); +assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-string.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-string.js index dc897c34dd..75c40c9a3f 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/argument-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-string.js @@ -11,20 +11,13 @@ features: [Temporal] for (const input of TemporalHelpers.ISO.plainYearMonthStringsValid()) { const plainYearMonth = Temporal.PlainYearMonth.from(input); TemporalHelpers.assertPlainYearMonth(plainYearMonth, 1976, 11, "M11"); - const fields = plainYearMonth.getISOFields(); - assert.sameValue(fields.calendar, "iso8601", "calendar slot should store a string"); - assert.sameValue(fields.isoDay, 1, "isoDay"); - assert.sameValue(fields.isoMonth, 11, "isoMonth"); - assert.sameValue(fields.isoYear, 1976, "isoYear"); + assert.sameValue(plainYearMonth.calendarId, "iso8601", "calendar string should be iso8601"); + assert.sameValue(plainYearMonth.toString({ calendarName: "always" }), "1976-11-01[u-ca=iso8601]", "iso reference date"); } for (const input of TemporalHelpers.ISO.plainYearMonthStringsValidNegativeYear()) { const plainYearMonth = Temporal.PlainYearMonth.from(input); TemporalHelpers.assertPlainYearMonth(plainYearMonth, -9999, 11, "M11"); - const fields = plainYearMonth.getISOFields(); - assert.sameValue(fields.calendar, "iso8601", "calendar slot should store a string"); - assert.sameValue(fields.isoDay, 1, "isoDay"); - assert.sameValue(fields.isoMonth, 11, "isoMonth"); - assert.sameValue(fields.isoYear, -9999, "isoYear"); - assert.sameValue(plainYearMonth.toString(), "-009999-11"); + assert.sameValue(plainYearMonth.calendarId, "iso8601", "calendar string should be iso8601"); + assert.sameValue(plainYearMonth.toString({ calendarName: "always" }), "-009999-11-01[u-ca=iso8601]", "iso reference date"); } diff --git a/test/built-ins/Temporal/PlainYearMonth/from/calendar-temporal-object.js b/test/built-ins/Temporal/PlainYearMonth/from/calendar-temporal-object.js index 0762b8e364..c84863db1e 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/calendar-temporal-object.js @@ -22,5 +22,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject) => { const result = Temporal.PlainYearMonth.from({ year: 2000, month: 5, calendar: temporalObject }); - assert.sameValue(result.getISOFields().calendar, "iso8601", "Temporal object coerced to calendar"); + assert.sameValue(result.calendarId, "iso8601", "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/with/basic.js b/test/built-ins/Temporal/PlainYearMonth/prototype/with/basic.js index 7d49806ea6..ff59ced152 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/with/basic.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/with/basic.js @@ -19,5 +19,5 @@ TemporalHelpers.assertPlainYearMonth(ym.with({ month: 1, years: 2020 }), 2019, 1 const withDay = ym.with({ year: 2019, get day() { throw new Test262Error("should not read the day property") } }); TemporalHelpers.assertPlainYearMonth(withDay, 2019, 10, "M10", "day property"); -assert.sameValue(withDay.getISOFields().isoDay, 1); - +const isoDay = Number(withDay.toString({ calendarName: "always" }).split("-")[2].slice(0, 2)); +assert.sameValue(isoDay, 1); diff --git a/test/built-ins/Temporal/PlainYearMonth/refisoday-undefined.js b/test/built-ins/Temporal/PlainYearMonth/refisoday-undefined.js index 3172cdb86f..16c27bb698 100644 --- a/test/built-ins/Temporal/PlainYearMonth/refisoday-undefined.js +++ b/test/built-ins/Temporal/PlainYearMonth/refisoday-undefined.js @@ -10,7 +10,9 @@ features: [Temporal] const args = [2000, 5]; const dateExplicit = new Temporal.PlainYearMonth(...args, undefined); -assert.sameValue(dateExplicit.getISOFields().isoDay, 1, "default referenceISODay is 1"); +const isoDayExplicit = Number(dateExplicit.toString({ calendarName: "always" }).split("-")[2].slice(0, 2)); +assert.sameValue(isoDayExplicit, 1, "default referenceISODay is 1"); const dateImplicit = new Temporal.PlainYearMonth(...args); -assert.sameValue(dateImplicit.getISOFields().isoDay, 1, "default referenceISODay is 1"); +const isoDayImplicit = Number(dateImplicit.toString({ calendarName: "always" }).split("-")[2].slice(0, 2)); +assert.sameValue(isoDayImplicit, 1, "default referenceISODay is 1"); diff --git a/test/built-ins/Temporal/ZonedDateTime/calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/calendar-string.js index 35be85afeb..bcd40a23d7 100644 --- a/test/built-ins/Temporal/ZonedDateTime/calendar-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/calendar-string.js @@ -10,4 +10,4 @@ features: [Temporal] const arg = "iso8601"; const result = new Temporal.ZonedDateTime(0n, "UTC", arg); -assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/calendar-undefined.js b/test/built-ins/Temporal/ZonedDateTime/calendar-undefined.js index 3e8b1f446c..49c7b201fa 100644 --- a/test/built-ins/Temporal/ZonedDateTime/calendar-undefined.js +++ b/test/built-ins/Temporal/ZonedDateTime/calendar-undefined.js @@ -10,7 +10,7 @@ features: [BigInt, Temporal] const args = [957270896987654321n, "UTC"]; const explicit = new Temporal.ZonedDateTime(...args, undefined); -assert.sameValue(explicit.getISOFields().calendar, "iso8601", "calendar slot should store a string"); +assert.sameValue(explicit.calendarId, "iso8601", "calendar string should be iso8601"); const implicit = new Temporal.ZonedDateTime(...args); -assert.sameValue(implicit.getISOFields().calendar, "iso8601", "calendar slot should store a string"); +assert.sameValue(implicit.calendarId, "iso8601", "calendar string should be iso8601"); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-iso-string.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-iso-string.js index 5e2cabddc8..51c2432b8d 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-iso-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-iso-string.js @@ -21,5 +21,5 @@ for (const calendar of [ const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; const result = Temporal.ZonedDateTime.from(arg); assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${calendar}"`); - assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); + assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); } diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js index d2f252e72d..4b9a1ff43b 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js @@ -13,4 +13,4 @@ const timeZone = "UTC"; const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; const result = Temporal.ZonedDateTime.from(arg); assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${calendar}"`); -assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar slot stores a string"); +assert.sameValue(result.calendarId, "iso8601", "calendar string is iso8601"); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string.js index 264fcbb478..d9f5357bdc 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string.js @@ -4,11 +4,10 @@ /*--- esid: sec-temporal.zoneddatetime.from description: Time zone IDs are valid input for a time zone -includes: [temporalHelpers.js] features: [Temporal] ---*/ ["UTC", "+01:30"].forEach((timeZone) => { const result = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); - assert.sameValue(result.getISOFields().timeZone, timeZone, `Time zone created from string "${timeZone}"`); + assert.sameValue(result.timeZoneId, timeZone, `Time zone created from string "${timeZone}"`); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-zoneddatetime.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-zoneddatetime.js index b8b669175d..99bbc6c99f 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-zoneddatetime.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-zoneddatetime.js @@ -12,7 +12,7 @@ const result = Temporal.ZonedDateTime.from(orig); assert.sameValue(result.epochNanoseconds, 946684800_000_000_010n, "ZonedDateTime is copied"); assert.sameValue(result.timeZone, orig.timeZone, "time zone is the same"); -assert.sameValue(result.getISOFields().calendar, orig.getISOFields().calendar, "calendar is the same"); +assert.sameValue(result.calendarId, orig.calendarId, "calendar is the same"); assert.notSameValue( result, diff --git a/test/built-ins/Temporal/ZonedDateTime/from/calendar-temporal-object.js b/test/built-ins/Temporal/ZonedDateTime/from/calendar-temporal-object.js index 4e890cede2..57748dadee 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/calendar-temporal-object.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/calendar-temporal-object.js @@ -22,5 +22,5 @@ features: [Temporal] TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject) => { const result = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: "UTC", calendar: temporalObject }); - assert.sameValue(result.getISOFields().calendar, "iso8601", "Temporal object coerced to calendar"); + assert.sameValue(result.calendarId, "iso8601", "Temporal object coerced to calendar"); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-iso-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-iso-string.js index 293899e0b7..a1cb08cfcc 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-iso-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-iso-string.js @@ -20,5 +20,5 @@ for (const arg of [ "2020-01[u-ca=iso8601]", ]) { const result = instance.withCalendar(arg); - assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); + assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); } diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js index 7a57288cfb..73cb949c31 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js @@ -12,4 +12,4 @@ const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", " const arg = "iso8601"; const result = instance.withCalendar(arg); -assert.sameValue(result.getISOFields().calendar, "iso8601", `Calendar created from string "${arg}"`); +assert.sameValue(result.calendarId, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js index 2ca1f9763c..9b32a99ed2 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js @@ -24,8 +24,6 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const actual = []; const expected = []; - const calendar = arg.getISOFields().calendar; - Object.defineProperty(arg, "calendar", { get() { actual.push("get calendar"); @@ -35,7 +33,7 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", "iso8601"); const result = instance.withCalendar(arg); - assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); + assert.sameValue(result.calendarId, "iso8601", "Temporal object coerced to calendar"); assert.compareArray(actual, expected, "calendar getter not called"); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js index f12f0e4024..b32d5ec2ec 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js @@ -24,6 +24,6 @@ TemporalHelpers.checkSubclassingIgnored( assert.sameValue(result.millisecond, 0, "millisecond result"); assert.sameValue(result.microsecond, 0, "microsecond result"); assert.sameValue(result.nanosecond, 10, "nanosecond result"); - assert.sameValue(result.getISOFields().calendar, "iso8601", "calendar result"); + assert.sameValue(result.calendarId, "iso8601", "calendar result"); }, ); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string.js index f01e774f73..78c2d2a08e 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string.js @@ -4,7 +4,6 @@ /*--- esid: sec-temporal.zoneddatetime.prototype.withtimezone description: Time zone IDs are valid input for a time zone -includes: [temporalHelpers.js] features: [Temporal] ---*/ @@ -12,5 +11,5 @@ const instance = new Temporal.ZonedDateTime(0n, "UTC"); ["UTC", "+01:30"].forEach((timeZone) => { const result = instance.withTimeZone(timeZone); - assert.sameValue(result.getISOFields().timeZone, timeZone, `time zone slot should store string "${timeZone}"`); + assert.sameValue(result.timeZoneId, timeZone, `time zone slot should store string "${timeZone}"`); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/timezone-string.js b/test/built-ins/Temporal/ZonedDateTime/timezone-string.js index d83ef4c271..6b74615d6e 100644 --- a/test/built-ins/Temporal/ZonedDateTime/timezone-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/timezone-string.js @@ -9,5 +9,5 @@ features: [Temporal] ["UTC", "+01:30"].forEach((timeZone) => { const result = new Temporal.ZonedDateTime(0n, timeZone); - assert.sameValue(result.getISOFields().timeZone, timeZone, `time zone slot should store string "${timeZone}"`); + assert.sameValue(result.timeZoneId, timeZone, `time zone ID should be "${timeZone}"`); }); diff --git a/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js b/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js index 79a59151e3..edb7cec3db 100644 --- a/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js +++ b/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js @@ -9,7 +9,5 @@ features: [Temporal] const zdt = Temporal.Now.zonedDateTimeISO("America/Los_Angeles"); assert(zdt instanceof Temporal.ZonedDateTime); -assert.sameValue(typeof zdt.getISOFields().calendar, "string", "calendar slot should store a string"); assert.sameValue(zdt.calendarId, "iso8601"); -assert.sameValue(typeof zdt.getISOFields().timeZone, "string", "time zone slot should store a string"); assert.sameValue(zdt.timeZoneId, "America/Los_Angeles"); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withCalendar/argument-string.js b/test/intl402/Temporal/PlainDateTime/prototype/withCalendar/argument-string.js index 652a668b0a..b250c1cc44 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withCalendar/argument-string.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withCalendar/argument-string.js @@ -17,11 +17,7 @@ TemporalHelpers.assertPlainDateTime( "'iso8601' is a recognizable calendar" ); -assert.sameValue( - result.getISOFields().calendar, - "iso8601", - "underlying calendar has changed and calendar slot stores a string" -); +assert.sameValue(result.calendarId, "iso8601", "underlying calendar has changed"); assert.throws( RangeError, diff --git a/test/intl402/Temporal/PlainMonthDay/from/reference-year-1972.js b/test/intl402/Temporal/PlainMonthDay/from/reference-year-1972.js index c89bf601b5..e0a5b6cad4 100644 --- a/test/intl402/Temporal/PlainMonthDay/from/reference-year-1972.js +++ b/test/intl402/Temporal/PlainMonthDay/from/reference-year-1972.js @@ -68,5 +68,4 @@ TemporalHelpers.assertPlainMonthDay( "reference date should be the later one, if two options exist in ISO year 1972", 1972 ); -assert.sameValue(result7.getISOFields().isoMonth, 12, "reference date should be 1972-12-31"); -assert.sameValue(result7.getISOFields().isoDay, 31, "reference date should be 1972-12-31"); +assert.sameValue(result7.toString(), "1972-12-31[u-ca=hebrew]", "reference date"); diff --git a/test/intl402/Temporal/PlainYearMonth/from/reference-day-chinese.js b/test/intl402/Temporal/PlainYearMonth/from/reference-day-chinese.js index 5235fbdd6a..0a8e3581bf 100644 --- a/test/intl402/Temporal/PlainYearMonth/from/reference-day-chinese.js +++ b/test/intl402/Temporal/PlainYearMonth/from/reference-day-chinese.js @@ -78,7 +78,6 @@ for (const [monthCode, relatedYear, month, referenceISODay, isoYear = relatedYea `Date of sample Chinese intercalary month ${monthCode}`, /* era = */ undefined, /* era year = */ undefined, referenceISODay ); - const isoFields = result.getISOFields(); - assert.sameValue(isoFields.isoYear, isoYear, `${year}-${monthCode} starts in ISO year ${isoYear}`); - assert.sameValue(isoFields.isoMonth, isoMonth, `${year}-${monthCode} starts in ISO month ${isoMonth}`); + const isoYearMonth = result.toString().slice(0, 7); + assert.sameValue(isoYearMonth, `${isoYear}-${String(isoMonth).padStart(2, '0')}`, `${year}-${monthCode} starts in ISO month ${isoYear}-${isoMonth}`); } diff --git a/test/intl402/Temporal/PlainYearMonth/from/reference-day-hebrew.js b/test/intl402/Temporal/PlainYearMonth/from/reference-day-hebrew.js index b609c38ae8..e1847d4619 100644 --- a/test/intl402/Temporal/PlainYearMonth/from/reference-day-hebrew.js +++ b/test/intl402/Temporal/PlainYearMonth/from/reference-day-hebrew.js @@ -18,9 +18,8 @@ TemporalHelpers.assertPlainYearMonth( "reference day is the first of the calendar month even if day is given", /* era = */ undefined, /* era year = */ undefined, /* reference day = */ 5 ); -const isoFields = result4.getISOFields(); -assert.sameValue(isoFields.isoYear, 2021, "Tevet 5782 begins in ISO year 2021"); -assert.sameValue(isoFields.isoMonth, 12, "Tevet 5782 begins in ISO month 12"); +const isoYearMonth = result4.toString().slice(0, 7); +assert.sameValue(isoYearMonth, "2021-12", "Tevet 5782 begins in ISO 2021-12"); const result5 = Temporal.PlainYearMonth.from({ year: 5783, monthCode: "M05L", calendar: "hebrew" }, { overflow: "constrain" }); TemporalHelpers.assertPlainYearMonth( diff --git a/test/staging/Intl402/Temporal/old/islamic-calendars.js b/test/staging/Intl402/Temporal/old/islamic-calendars.js index 47bad664c2..dc68093b25 100644 --- a/test/staging/Intl402/Temporal/old/islamic-calendars.js +++ b/test/staging/Intl402/Temporal/old/islamic-calendars.js @@ -15,53 +15,42 @@ const tests = [ inLeapYear: false, daysInYear: 354, daysInMonth12: 29, - isoYear: 2023, - isoMonth: 7, - isoDay: 18 + isoDate: "2023-07-18", }, { calendar: "islamic-umalqura", inLeapYear: false, daysInYear: 354, daysInMonth12: 30, - isoYear: 2023, - isoMonth: 7, - isoDay: 19 + isoDate: "2023-07-19", }, { calendar: "islamic-civil", inLeapYear: true, daysInYear: 355, daysInMonth12: 30, - isoYear: 2023, - isoMonth: 7, - isoDay: 19 + isoDate: "2023-07-19", }, { calendar: "islamic-rgsa", inLeapYear: false, daysInYear: 354, daysInMonth12: 29, - isoYear: 2023, - isoMonth: 7, - isoDay: 18 + isoDate: "2023-07-18", }, { calendar: "islamic-tbla", inLeapYear: true, daysInYear: 355, daysInMonth12: 30, - isoYear: 2023, - isoMonth: 7, - isoDay: 18 + isoDate: "2023-07-18", } ]; for (const test of tests) { - const { calendar, inLeapYear, daysInYear, daysInMonth12, isoYear, isoMonth, isoDay } = test; + const { calendar, inLeapYear, daysInYear, daysInMonth12, isoDate } = test; const year = 1445; const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar }); - const isoFields = date.getISOFields(); assert.sameValue(date.calendarId, calendar); assert.sameValue(date.year, year); assert.sameValue(date.month, 1); @@ -76,7 +65,5 @@ for (const test of tests) { assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear); const dateMonth12 = date.with({ month: 12 }); assert.sameValue(dateMonth12.daysInMonth, daysInMonth12); - assert.sameValue(isoYear, isoFields.isoYear); - assert.sameValue(isoMonth, isoFields.isoMonth); - assert.sameValue(isoDay, isoFields.isoDay); + assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date"); } diff --git a/test/staging/Intl402/Temporal/old/persian-calendar.js b/test/staging/Intl402/Temporal/old/persian-calendar.js index 189ccc994c..a5020f4b54 100644 --- a/test/staging/Intl402/Temporal/old/persian-calendar.js +++ b/test/staging/Intl402/Temporal/old/persian-calendar.js @@ -15,61 +15,48 @@ const tests = [ inLeapYear: true, daysInYear: 366, daysInMonth12: 30, - isoYear: 2016, - isoMonth: 3, - isoDay: 20 + isoDate: "2016-03-20", }, { testYear: 1396, inLeapYear: false, daysInYear: 365, daysInMonth12: 29, - isoYear: 2017, - isoMonth: 3, - isoDay: 21 + isoDate: "2017-03-21", }, { testYear: 1397, inLeapYear: false, daysInYear: 365, daysInMonth12: 29, - isoYear: 2018, - isoMonth: 3, - isoDay: 21 + isoDate: "2018-03-21", }, { testYear: 1398, inLeapYear: false, daysInYear: 365, daysInMonth12: 29, - isoYear: 2019, - isoMonth: 3, - isoDay: 21 + isoDate: "2019-03-21", }, { testYear: 1399, inLeapYear: true, daysInYear: 366, daysInMonth12: 30, - isoYear: 2020, - isoMonth: 3, - isoDay: 20 + isoDate: "2020-03-20", }, { testYear: 1400, inLeapYear: false, daysInYear: 365, daysInMonth12: 29, - isoYear: 2021, - isoMonth: 3, - isoDay: 21 + isoDate: "2021-03-21", } ]; for (const test of tests) { - const { testYear, inLeapYear, daysInYear, daysInMonth12, isoYear, isoMonth, isoDay } = test; + const { testYear, inLeapYear, daysInYear, daysInMonth12, isoDate } = test; const date = Temporal.PlainDate.from({ year: testYear, month: 1, day: 1, calendar: "persian" }); - const isoFields = date.getISOFields(); assert.sameValue(date.calendarId, "persian"); assert.sameValue(date.year, testYear); assert.sameValue(date.month, 1); @@ -84,7 +71,5 @@ for (const test of tests) { assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear); const dateMonth12 = date.with({ month: 12 }); assert.sameValue(dateMonth12.daysInMonth, daysInMonth12); - assert.sameValue(isoYear, isoFields.isoYear); - assert.sameValue(isoMonth, isoFields.isoMonth); - assert.sameValue(isoDay, isoFields.isoDay); + assert.sameValue(date.toString(), `${isoDate}[u-ca=persian]`, "ISO reference date"); } diff --git a/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js b/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js index eca34dd442..03b828c53e 100644 --- a/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js +++ b/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js @@ -13,4 +13,4 @@ assert.sameValue(`${ zdt.toPlainDate() }`, "2019-10-29"); // preserves the calendar var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTimeISO("-07:00").withCalendar("gregory"); -assert.sameValue(zdt.toPlainDate().getISOFields().calendar, "gregory"); +assert.sameValue(zdt.toPlainDate().calendarId, "gregory"); diff --git a/test/staging/Temporal/ZonedDateTime/old/withCalendar.js b/test/staging/Temporal/ZonedDateTime/old/withCalendar.js index d6f0d4c382..ec873e8bae 100644 --- a/test/staging/Temporal/ZonedDateTime/old/withCalendar.js +++ b/test/staging/Temporal/ZonedDateTime/old/withCalendar.js @@ -16,5 +16,5 @@ assert.sameValue(`${ zdt.withCalendar("japanese") }`, "2019-11-18T15:23:30.12345 var zdt = Temporal.ZonedDateTime.from("2019-11-18T15:23:30.123456789+01:00[+01:00][u-ca=iso8601]"); var zdt2 = zdt.withCalendar("japanese"); assert.sameValue(zdt.epochNanoseconds, zdt2.epochNanoseconds); -assert.sameValue(zdt2.getISOFields().calendar, "japanese"); +assert.sameValue(zdt2.calendarId, "japanese"); assert.sameValue(zdt2.timeZoneId, "+01:00"); diff --git a/test/staging/Temporal/ZonedDateTime/old/withTimezone.js b/test/staging/Temporal/ZonedDateTime/old/withTimezone.js index 2d7cf02aa5..c41eeb4679 100644 --- a/test/staging/Temporal/ZonedDateTime/old/withTimezone.js +++ b/test/staging/Temporal/ZonedDateTime/old/withTimezone.js @@ -11,6 +11,6 @@ features: [Temporal] var zdt = Temporal.ZonedDateTime.from("2019-11-18T15:23:30.123456789+01:00[+01:00]").withCalendar("gregory"); var zdt2 = zdt.withTimeZone("-08:00"); assert.sameValue(zdt.epochNanoseconds, zdt2.epochNanoseconds); -assert.sameValue(zdt2.getISOFields().calendar, "gregory"); +assert.sameValue(zdt2.calendarId, "gregory"); assert.sameValue(zdt2.timeZoneId, "-08:00"); assert.notSameValue(`${ zdt.toPlainDateTime() }`, `${ zdt2.toPlainDateTime() }`);