1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

LibJS: Handle PlainTime objects in ToTemporalCalendar

This commit is contained in:
Linus Groh 2021-07-28 19:11:26 +01:00
parent d3bed13f4b
commit c2d45e5a83

View file

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