From e16821f4605e73eb78a0ef523a67340590fea07b Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 22 Jan 2022 21:56:06 +0000 Subject: [PATCH] LibJS: Avoid ambiguity in TimeZone production This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/87a6b0d --- .../Libraries/LibJS/Runtime/Temporal/ISO8601.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp index 9af3ef742db..1777237b695 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp @@ -974,10 +974,15 @@ bool ISO8601Parser::parse_time_zone_name_required() bool ISO8601Parser::parse_time_zone() { // TimeZone : - // TimeZoneOffsetRequired - // TimeZoneNameRequired - return parse_time_zone_offset_required() - || parse_time_zone_name_required(); + // TimeZoneUTCOffset TimeZoneBracketedAnnotation[opt] + // TimeZoneBracketedAnnotation + StateTransaction transaction { *this }; + if (parse_time_zone_utc_offset()) + (void)parse_time_zone_bracketed_annotation(); + else if (!parse_time_zone_bracketed_annotation()) + return false; + transaction.commit(); + return true; } // https://tc39.es/proposal-temporal/#prod-CalendarName