diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index 2f4541e15a..22daa3ed18 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -1340,6 +1340,17 @@ export const ES = ObjectAssign({}, ES2020, { let hour, minute, second, millisecond, microsecond, nanosecond, calendar; if (ES.Type(item) === 'Object') { if (ES.IsTemporalTime(item)) return item; + if (ES.IsTemporalDateTime(item)) { + const TemporalPlainTime = GetIntrinsic('%Temporal.PlainTime%'); + return new TemporalPlainTime( + GetSlot(item, ISO_HOUR), + GetSlot(item, ISO_MINUTE), + GetSlot(item, ISO_SECOND), + GetSlot(item, ISO_MILLISECOND), + GetSlot(item, ISO_MICROSECOND), + GetSlot(item, ISO_NANOSECOND) + ); + } calendar = item.calendar; if (calendar) { calendar = ES.ToTemporalCalendar(calendar); diff --git a/spec/plaintime.html b/spec/plaintime.html index 5906594a4f..38ff1445ef 100644 --- a/spec/plaintime.html +++ b/spec/plaintime.html @@ -610,6 +610,8 @@

ToTemporalTime ( _item_ [ , _overflow_ ] )

1. If Type(_item_) is Object, then 1. If _item_ has an [[InitializedTemporalTime]] internal slot, then 1. Return _item_. + 1. If _item_ has an [[InitializedTemporalDateTime]] internal slot, then + 1. Return ! CreateTemporalTime(_item_.[[ISOHour]], _item_.[[ISOMinute]], _item_.[[ISOSecond]], _item_.[[ISOMillisecond]], _item_.[[ISOMicrosecond]], _item_.[[ISONanosecond]]). 1. Let _calendar_ be ? Get(_item_, *"calendar"*). 1. If _calendar_ is not *undefined*, then 1. Set _calendar_ to ? ToTemporalCalendar(_calendar_).