Skip to content

Commit

Permalink
Normative: Remove support for nested time zone property bags
Browse files Browse the repository at this point in the history
Previously, "nested" time zone property bags were unwrapped up to one
level. That is, this object:
{
  timeZone: {
     // ...Temporal.TimeZone methods
  }
}
would not be considered to implement the TimeZone protocol, but would have
its timeZone property used instead, if it were passed to an API that
required a TimeZone protocol object.

These nested property bags are no longer supported. Discussion:
#2104 (comment)

See: #2104

UPSTREAM_COMMIT=1b097998da0bc4bd2a98aaf3427ecca4d707f7ec
  • Loading branch information
ptomato authored and justingrant committed Apr 20, 2023
1 parent 349e5ba commit 1ce64a0
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2063,19 +2063,11 @@ export function CalendarMonthDayFromFields(calendar, fields, options) {

export function ToTemporalTimeZoneSlotValue(temporalTimeZoneLike) {
if (Type(temporalTimeZoneLike) === 'Object') {
if (IsTemporalTimeZone(temporalTimeZoneLike)) return temporalTimeZoneLike;
if (IsTemporalZonedDateTime(temporalTimeZoneLike)) return GetSlot(temporalTimeZoneLike, TIME_ZONE);
if (IsTemporalCalendar(temporalTimeZoneLike)) {
throw new RangeError('Expected a time zone object but received a Temporal.Calendar');
}
if (!('timeZone' in temporalTimeZoneLike)) return temporalTimeZoneLike;
temporalTimeZoneLike = temporalTimeZoneLike.timeZone;
if (Type(temporalTimeZoneLike) === 'Object') {
if (IsTemporalCalendar(temporalTimeZoneLike)) {
throw new RangeError('Expected a time zone object as the timeZone property but received a Temporal.Calendar');
}
if (!('timeZone' in temporalTimeZoneLike)) return temporalTimeZoneLike;
}
return temporalTimeZoneLike;
}
const identifier = ToString(temporalTimeZoneLike);
return ParseTemporalTimeZone(identifier);
Expand Down

0 comments on commit 1ce64a0

Please sign in to comment.