mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:58:11 +00:00
LibJS: Use infallible ParseTimeZoneOffsetString
This is an editorial change in the Temporal spec. See:
654e300
This commit is contained in:
parent
d992cba014
commit
443ffab9dc
7 changed files with 83 additions and 138 deletions
|
@ -197,8 +197,8 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item
|
|||
// e. Assert: timeZoneName is not undefined.
|
||||
VERIFY(time_zone_name.has_value());
|
||||
|
||||
// f. If ParseText(StringToCodePoints(timeZoneName), TimeZoneNumericUTCOffset) is a List of errors, then
|
||||
if (!is_valid_time_zone_numeric_utc_offset_syntax(*time_zone_name)) {
|
||||
// f. If IsTimeZoneOffsetString(timeZoneName) is false, then
|
||||
if (!is_time_zone_offset_string(*time_zone_name)) {
|
||||
// i. If IsValidTimeZoneName(timeZoneName) is false, throw a RangeError exception.
|
||||
if (!is_valid_time_zone_name(*time_zone_name))
|
||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeZoneName, *time_zone_name);
|
||||
|
@ -239,8 +239,12 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item
|
|||
|
||||
// 8. If offsetBehaviour is option, then
|
||||
if (offset_behavior == OffsetBehavior::Option) {
|
||||
// a. If IsTimeZoneOffsetString(offsetString) is false, throw a RangeError exception.
|
||||
if (!is_time_zone_offset_string(*offset_string))
|
||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeZoneName, *offset_string);
|
||||
|
||||
// a. Set offsetNanoseconds to ? ParseTimeZoneOffsetString(offsetString).
|
||||
offset_nanoseconds = TRY(parse_time_zone_offset_string(vm, *offset_string));
|
||||
offset_nanoseconds = parse_time_zone_offset_string(*offset_string);
|
||||
}
|
||||
|
||||
// 9. Let disambiguation be ? ToTemporalDisambiguation(options).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue