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:
parent
9628452550
commit
27304017e3
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue