mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibJS: Use Temporal's ISO8601 parser to parse UTC offset strings
We now have the Temporal facilities to implement the Date AOs which parse UTC offset strings using the ISO8601 parser. This patch updates those AOs and their callers in accordance with the Temporal spec.
This commit is contained in:
parent
64811ab7b6
commit
c6fccc04e1
Notes:
github-actions[bot]
2024-11-22 00:25:18 +00:00
Author: https://github.com/trflynn89
Commit: c6fccc04e1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2471
6 changed files with 113 additions and 284 deletions
|
@ -1366,10 +1366,7 @@ ThrowCompletionOr<String> to_offset_string(VM& vm, Value argument)
|
|||
return vm.throw_completion<TypeError>(ErrorType::TemporalInvalidTimeZoneString, offset);
|
||||
|
||||
// 3. Perform ? ParseDateTimeUTCOffset(offset).
|
||||
// FIXME: ParseTimeZoneOffsetString should be renamed to ParseDateTimeUTCOffset and updated for Temporal. For now, we
|
||||
// can just check with the ISO8601 parser directly.
|
||||
if (!parse_utc_offset(argument.as_string().utf8_string_view(), SubMinutePrecision::Yes).has_value())
|
||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeZoneString, offset);
|
||||
TRY(parse_date_time_utc_offset(vm, offset.as_string().utf8_string_view()));
|
||||
|
||||
// 4. Return offset.
|
||||
return offset.as_string().utf8_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue