LibJS: Handle ZonedDateTime in ToTemporalCalendar

This commit is contained in:
Linus Groh 2021-08-01 17:54:28 +01:00
parent cfb77b66e5
commit 14e7eff43f
Notes: sideshowbarker 2024-07-18 07:38:20 +09:00

View file

@ -13,6 +13,7 @@
#include <LibJS/Runtime/Temporal/PlainDate.h>
#include <LibJS/Runtime/Temporal/PlainDateTime.h>
#include <LibJS/Runtime/Temporal/PlainTime.h>
#include <LibJS/Runtime/Temporal/ZonedDateTime.h>
#include <LibJS/Runtime/Value.h>
namespace JS::Temporal {
@ -300,7 +301,9 @@ Object* to_temporal_calendar(GlobalObject& global_object, Value temporal_calenda
return &static_cast<PlainDateTime&>(temporal_calendar_like_object).calendar();
if (is<PlainTime>(temporal_calendar_like_object))
return &static_cast<PlainTime&>(temporal_calendar_like_object).calendar();
// TODO: The rest of the Temporal built-ins (PlainMonthDay, PlainYearMonth, ZonedDateTime)
if (is<ZonedDateTime>(temporal_calendar_like_object))
return &static_cast<ZonedDateTime&>(temporal_calendar_like_object).calendar();
// TODO: The rest of the Temporal built-ins (PlainMonthDay, PlainYearMonth)
// b. If ? HasProperty(temporalCalendarLike, "calendar") is false, return temporalCalendarLike.
auto has_property = temporal_calendar_like_object.has_property(vm.names.calendar);