Skip to content

Commit

Permalink
Remove ISO string -> calendar conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomato committed Jan 19, 2023
1 parent 357c39b commit e87cca2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
16 changes: 2 additions & 14 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1808,20 +1808,8 @@ export const ES = ObjectAssign({}, ES2022, {
return calendarLike;
}
const identifier = ES.ToString(calendarLike);
if (ES.IsBuiltinCalendar(identifier)) return ES.ASCIILowercase(identifier);
let calendar;
try {
({ calendar } = ES.ParseISODateTime(identifier));
} catch {
try {
({ calendar } = ES.ParseTemporalYearMonthString(identifier));
} catch {
({ calendar } = ES.ParseTemporalMonthDayString(identifier));
}
}
if (!calendar) calendar = 'iso8601';
if (!ES.IsBuiltinCalendar(calendar)) throw new RangeError(`invalid calendar identifier ${calendar}`);
return ES.ASCIILowercase(calendar);
if (!ES.IsBuiltinCalendar(identifier)) throw new RangeError(`invalid calendar identifier ${identifier}`);
return ES.ASCIILowercase(identifier);
},
GetTemporalCalendarSlotValueWithISODefault: (item) => {
if (HasSlot(item, CALENDAR)) return GetSlot(item, CALENDAR);
Expand Down
1 change: 0 additions & 1 deletion spec/calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,6 @@ <h1>
1. If _temporalCalendarLike_ has an [[InitializedTemporalTime]] or [[InitializedTemporalTimeZone]] internal slot, throw a *RangeError* exception.
1. Return _temporalCalendarLike_.
1. Let _identifier_ be ? ToString(_temporalCalendarLike_).
1. Set _identifier_ to ? ParseTemporalCalendarString(_identifier_).
1. If IsBuiltinCalendar(_identifier_) is *false*, throw a *RangeError* exception.
1. Return the ASCII-lowercase of _identifier_.
</emu-alg>
Expand Down

0 comments on commit e87cca2

Please sign in to comment.