mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02: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:
Notes:
github-actions[bot]
2024-11-22 00:25:18 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/c6fccc04e16 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2471
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user