diff --git a/polyfill/lib/calendar.mjs b/polyfill/lib/calendar.mjs index 3d72741f04..a494a7bf94 100644 --- a/polyfill/lib/calendar.mjs +++ b/polyfill/lib/calendar.mjs @@ -2160,3 +2160,10 @@ impl['indian'] = ObjectAssign({}, nonIsoGeneralImpl, { helper: helperIndian }); impl['buddhist'] = ObjectAssign({}, nonIsoGeneralImpl, { helper: helperBuddhist }); impl['japanese'] = ObjectAssign({}, nonIsoGeneralImpl, { helper: helperJapanese }); impl['gregory'] = ObjectAssign({}, nonIsoGeneralImpl, { helper: helperGregory }); + +function calendarFieldsImpl(calendar, fieldNames) { + return impl[calendar].fields(fieldNames); +} +// Probably not what the intrinsics mechanism was intended for, but view this as +// an export of calendarFieldsImpl while avoiding circular dependencies +DefineIntrinsic('calendarFieldsImpl', calendarFieldsImpl); diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index 9c17e94113..33d358615f 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -1803,9 +1803,8 @@ export function CreateTemporalZonedDateTime(epochNanoseconds, timeZone, calendar export function CalendarFields(calendar, fieldNames) { if (typeof calendar === 'string') { - const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%'); - calendar = new TemporalCalendar(calendar); - return Call(GetIntrinsic('%Temporal.Calendar.prototype.fields%'), calendar, [fieldNames]); + if (calendar === 'iso8601') return fieldNames; + return GetIntrinsic('%calendarFieldsImpl%')(calendar, fieldNames); } const fields = GetMethod(calendar, 'fields'); fieldNames = Call(fields, calendar, [fieldNames]); diff --git a/spec/calendar.html b/spec/calendar.html index 42bca64e90..75fdf17ada 100644 --- a/spec/calendar.html +++ b/spec/calendar.html @@ -99,9 +99,12 @@