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

LibJS: Port calendar / time zone members of Temporal* structs to String

This commit is contained in:
Linus Groh 2023-01-26 15:00:53 +00:00
parent ef389c086d
commit 4a7d6670d8
4 changed files with 25 additions and 25 deletions

View file

@ -130,7 +130,7 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item
Object* calendar = nullptr;
Object* time_zone = nullptr;
Optional<DeprecatedString> offset_string;
Optional<String> offset_string;
ISODateTime result;
// 5. If Type(item) is Object, then
@ -203,7 +203,7 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeZoneName, *time_zone_name);
// ii. Set timeZoneName to ! CanonicalizeTimeZoneName(timeZoneName).
time_zone_name = canonicalize_time_zone_name(*time_zone_name);
time_zone_name = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(canonicalize_time_zone_name(time_zone_name->to_deprecated_string())));
}
// g. Let offsetString be result.[[TimeZone]].[[OffsetString]].
@ -221,7 +221,7 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item
}
// j. Let timeZone be ! CreateTemporalTimeZone(timeZoneName).
time_zone = MUST(create_temporal_time_zone(vm, *time_zone_name));
time_zone = MUST(create_temporal_time_zone(vm, time_zone_name->to_deprecated_string()));
// k. Let calendar be ? ToTemporalCalendarWithISODefault(result.[[Calendar]]).
auto temporal_calendar_like = result.calendar.has_value()