summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-07-25 19:41:24 +0100
committerLinus Groh <mail@linusgroh.de>2021-07-25 23:44:36 +0100
commitc1005dbb0a6faf9bc71f10bea593c14ce0b1558c (patch)
treedfd217c0a173185b88870f3bf70e72fcc243db25 /Userland
parent1c1354db07cbc371475fb8a1d1adfe6ead89b189 (diff)
downloadserenity-c1005dbb0a6faf9bc71f10bea593c14ce0b1558c.zip
LibJS: Handle PlainDateTime objects ToTemporalCalendar
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
index 18a10e73b5..33c1b009e0 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
@@ -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);