diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index d02519dc97..2f4541e15a 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -1186,6 +1186,21 @@ export const ES = ObjectAssign({}, ES2020, { let year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar; if (ES.Type(item) === 'Object') { if (ES.IsTemporalDateTime(item)) return item; + if (ES.IsTemporalDate(item)) { + const TemporalPlainDateTime = GetIntrinsic('%Temporal.PlainDateTime%'); + return new TemporalPlainDateTime( + GetSlot(item, ISO_YEAR), + GetSlot(item, ISO_MONTH), + GetSlot(item, ISO_DAY), + 0, + 0, + 0, + 0, + 0, + 0, + GetSlot(item, CALENDAR) + ); + } calendar = item.calendar; if (calendar === undefined) calendar = ES.GetISO8601Calendar(); diff --git a/spec/plaindatetime.html b/spec/plaindatetime.html index 3697202ee2..d172d41f1b 100644 --- a/spec/plaindatetime.html +++ b/spec/plaindatetime.html @@ -903,6 +903,8 @@

ToTemporalDateTime ( _item_ [ , _options_ ] )

1. If Type(_item_) is Object, then 1. If _item_ has an [[InitializedTemporalDateTime]] internal slot, then 1. Return _item_. + 1. If _item_ has an [[InitializedTemporalDate]] internal slot, then + 1. Return ? CreateTemporalDateTime(_item_.[[ISOYear]], _item_.[[ISOMonth]], _item_.[[ISODay]], 0, 0, 0, 0, 0, 0, _item_.[[Calendar]]). 1. Let _calendar_ be ? GetOptionalTemporalCalendar(_item_). 1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"hour"*, *"microsecond"*, *"millisecond"*, *"minute"*, *"month"*, *"monthCode"*, *"nanosecond"*, *"second"*, *"year"* »). 1. Let _fields_ be ? PrepareTemporalFields(_item_, _fieldNames_, «»).