LibJS: Handle PlainDateTime objects in GetTemporalCalendarWithISODefault

This commit is contained in:
Linus Groh 2021-07-25 19:42:14 +01:00
parent c1005dbb0a
commit d428787e18
Notes: sideshowbarker 2024-07-18 08:20:29 +09:00

View file

@ -356,11 +356,12 @@ Object* get_temporal_calendar_with_iso_default(GlobalObject& global_object, Obje
auto& vm = global_object.vm();
// 1. If item has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalTime]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
// TODO: The rest of the Temporal built-ins
if (is<PlainDate>(item)) {
// a. Return item.[[Calendar]].
// a. Return item.[[Calendar]].
if (is<PlainDate>(item))
return &static_cast<PlainDate&>(item).calendar();
}
if (is<PlainDateTime>(item))
return &static_cast<PlainDateTime&>(item).calendar();
// TODO: The rest of the Temporal built-ins (PlainMonthDay, PlainTime, PlainYearMonth, ZonedDateTime)
// 2. Let calendar be ? Get(item, "calendar").
auto calendar = item.get(vm.names.calendar);