1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:38:10 +00:00

LibJS: Handle PlainDateTime objects ToTemporalCalendar

This commit is contained in:
Linus Groh 2021-07-25 19:41:24 +01:00
parent 1c1354db07
commit c1005dbb0a

View file

@ -292,11 +292,12 @@ Object* to_temporal_calendar(GlobalObject& global_object, Value temporal_calenda
if (temporal_calendar_like.is_object()) {
auto& temporal_calendar_like_object = temporal_calendar_like.as_object();
// a. If temporalCalendarLike has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalTime]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
// TODO: The rest of the Temporal built-ins
if (is<PlainDate>(temporal_calendar_like_object)) {
// i. Return temporalCalendarLike.[[Calendar]].
// i. Return temporalCalendarLike.[[Calendar]].
if (is<PlainDate>(temporal_calendar_like_object))
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)
// b. If ? HasProperty(temporalCalendarLike, "calendar") is false, return temporalCalendarLike.
auto has_property = temporal_calendar_like_object.has_property(vm.names.calendar);