From f3aef8711fed5dcd1c5e1e5b149561e1e3d84fc9 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 5 Feb 2025 10:14:14 -0800 Subject: [PATCH] Update polyfill to match spec Implements the normative change from the previous commit in the reference code. --- polyfill/lib/ecmascript.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index 3ac0ac8f6..7844af9b1 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -1332,13 +1332,14 @@ export function ToTemporalMonthDay(item, options = undefined) { calendar = CanonicalizeCalendar(calendar); GetTemporalOverflowOption(GetOptionsObject(options)); - if (referenceISOYear === undefined) { - assert(calendar === 'iso8601', `missing year with non-"iso8601" calendar identifier ${calendar}`); + if (calendar === 'iso8601') { const isoCalendarReferenceYear = 1972; // First leap year after Unix epoch return CreateTemporalMonthDay({ year: isoCalendarReferenceYear, month, day }, calendar); } - const result = ISODateToFields(calendar, { year: referenceISOYear, month, day }, 'month-day'); - const isoDate = CalendarMonthDayFromFields(calendar, result, 'constrain'); + let isoDate = { year: referenceISOYear, month, day }; + RejectDateRange(isoDate); + const result = ISODateToFields(calendar, isoDate, 'month-day'); + isoDate = CalendarMonthDayFromFields(calendar, result, 'constrain'); return CreateTemporalMonthDay(isoDate, calendar); }