summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-03-31 00:48:57 +0100
committerLinus Groh <mail@linusgroh.de>2022-03-31 17:09:10 +0100
commitcfb04765fa83683944f96b535c336e5d607e9b60 (patch)
tree45d30d2a11068b14dfda39eb0cfa6e108a1c5a1d /Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
parentb020b8eea25471b371af2466ace2b80b8cd691ee (diff)
downloadserenity-cfb04765fa83683944f96b535c336e5d607e9b60.zip
LibJS: Correct PlainYearMonth arithmetic for non-ISO calendars
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/61e8dd0
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
index 75d7103fc7..fed58aee8d 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
@@ -457,7 +457,7 @@ ThrowCompletionOr<Object*> get_temporal_calendar_with_iso_default(GlobalObject&
}
// 12.1.24 DateFromFields ( calendar, fields, options ), https://tc39.es/proposal-temporal/#sec-temporal-datefromfields
-ThrowCompletionOr<PlainDate*> date_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const& options)
+ThrowCompletionOr<PlainDate*> date_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const* options)
{
auto& vm = global_object.vm();
@@ -465,7 +465,7 @@ ThrowCompletionOr<PlainDate*> date_from_fields(GlobalObject& global_object, Obje
// 2. Assert: Type(fields) is Object.
// 3. Let date be ? Invoke(calendar, "dateFromFields", ยซ fields, options ยป).
- auto date = TRY(Value(&calendar).invoke(global_object, vm.names.dateFromFields, &fields, &options));
+ auto date = TRY(Value(&calendar).invoke(global_object, vm.names.dateFromFields, &fields, options ?: js_undefined()));
// 4. Perform ? RequireInternalSlot(date, [[InitializedTemporalDate]]).
auto* date_object = TRY(date.to_object(global_object));