diff options
author | Linus Groh <mail@linusgroh.de> | 2022-04-07 23:51:54 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-04-08 00:43:17 +0100 |
commit | 2844a2c448133d18a8cef87d5665b01d638d6dc1 (patch) | |
tree | 4556d9750cd9e340ec184a4da5f7e0cbca88fcaf /Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp | |
parent | ada4f8d660c95552e21401091cb4ff4782445fbe (diff) | |
download | serenity-2844a2c448133d18a8cef87d5665b01d638d6dc1.zip |
LibJS: Handle undefined options in MergeLargestUnitOption
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/5e161a2
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp index 8de4a05592..5607db14dd 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp @@ -355,10 +355,6 @@ ThrowCompletionOr<DurationRecord> difference_iso_date_time(GlobalObject& global_ // 1. If options is not present, set options to undefined. // 2. Assert: Type(options) is Object or Undefined. - // FIXME: `options` is being passed to MergeLargestUnitOption unconditionally, which expects it to not be undefined (spec issue: https://github.com/tc39/proposal-temporal/issues/2132). - if (!options) - options = Object::create(global_object, nullptr); - // 3. Let timeDifference be ! DifferenceTime(h1, min1, s1, ms1, mus1, ns1, h2, min2, s2, ms2, mus2, ns2). auto time_difference = difference_time(hour1, minute1, second1, millisecond1, microsecond1, nanosecond1, hour2, minute2, second2, millisecond2, microsecond2, nanosecond2); @@ -390,7 +386,7 @@ ThrowCompletionOr<DurationRecord> difference_iso_date_time(GlobalObject& global_ auto date_largest_unit = larger_of_two_temporal_units("day"sv, largest_unit); // 11. Let untilOptions be ? MergeLargestUnitOption(options, dateLargestUnit). - auto* until_options = TRY(merge_largest_unit_option(global_object, *options, date_largest_unit)); + auto* until_options = TRY(merge_largest_unit_option(global_object, options, date_largest_unit)); // 12. Let dateDifference be ? CalendarDateUntil(calendar, date1, date2, untilOptions). auto* date_difference = TRY(calendar_date_until(global_object, calendar, date1, date2, *until_options)); |