Skip to content

Commit

Permalink
Update polyfill to match spec
Browse files Browse the repository at this point in the history
Implements the normative change from the previous commit in the reference
code.
  • Loading branch information
ptomato committed Feb 22, 2025
1 parent bd5ac12 commit f3aef87
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit f3aef87

Please sign in to comment.