mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 17:58:49 +00:00
LibJS: Don't use Temporal to parse UTC offset strings
The production for these strings has been removed from Temporal. This implements a separate parser in accordance with the Date spec.
This commit is contained in:
parent
f88826691c
commit
dd6acfecd4
Notes:
github-actions[bot]
2024-11-18 22:47:54 +00:00
Author: https://github.com/trflynn89
Commit: dd6acfecd4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2387
3 changed files with 192 additions and 40 deletions
|
@ -11,7 +11,6 @@
|
|||
#include <LibJS/Runtime/Intl/AbstractOperations.h>
|
||||
#include <LibJS/Runtime/Intl/DateTimeFormat.h>
|
||||
#include <LibJS/Runtime/Intl/DateTimeFormatConstructor.h>
|
||||
#include <LibJS/Runtime/Temporal/TimeZone.h>
|
||||
#include <LibUnicode/DateTimeFormat.h>
|
||||
#include <LibUnicode/Locale.h>
|
||||
|
||||
|
@ -205,13 +204,13 @@ ThrowCompletionOr<GC::Ref<DateTimeFormat>> create_date_time_format(VM& vm, Funct
|
|||
|
||||
if (is_time_zone_offset_string) {
|
||||
// a. Let parseResult be ParseText(StringToCodePoints(timeZone), UTCOffset).
|
||||
auto parse_result = Temporal::parse_iso8601(Temporal::Production::TimeZoneNumericUTCOffset, time_zone);
|
||||
auto parse_result = parse_utc_offset(time_zone);
|
||||
|
||||
// b. Assert: parseResult is a Parse Node.
|
||||
VERIFY(parse_result.has_value());
|
||||
|
||||
// c. If parseResult contains more than one MinuteSecond Parse Node, throw a RangeError exception.
|
||||
if (parse_result->time_zone_utc_offset_second.has_value())
|
||||
if (parse_result->second.has_value())
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, time_zone, vm.names.timeZone);
|
||||
|
||||
// d. Let offsetNanoseconds be ParseTimeZoneOffsetString(timeZone).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue