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

LibJS: Don't assume calendar was parsed in to_temporal_zoned_date_time()

The first step of to_temporal_calendar_with_iso_default() is checking
whether the given value is undefined, so we should actually pass that
instead of unconditionally dereferencing the Optional<String>.
This commit is contained in:
Linus Groh 2021-11-20 22:05:39 +00:00
parent 9628452550
commit 27304017e3

View file

@ -219,7 +219,10 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(GlobalObject& glob
time_zone = TRY(create_temporal_time_zone(global_object, *parsed_result.time_zone.name));
// i. Let calendar be ? ToTemporalCalendarWithISODefault(result.[[Calendar]]).
calendar = TRY(to_temporal_calendar_with_iso_default(global_object, js_string(vm, parsed_result.date_time.calendar.value())));
auto temporal_calendar_like = parsed_result.date_time.calendar.has_value()
? js_string(vm, parsed_result.date_time.calendar.value())
: js_undefined();
calendar = TRY(to_temporal_calendar_with_iso_default(global_object, temporal_calendar_like));
// j. Set matchBehaviour to match minutes.
match_behavior = MatchBehavior::MatchMinutes;