diff options
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp index cca5fb9370..af32991535 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp @@ -1149,6 +1149,15 @@ bool ISO8601Parser::parse_time_spec_with_optional_time_zone_not_ambiguous() // TimeHour : TimeMinute : TimeSecond TimeFraction[opt] TimeZone[opt] // TimeHour TimeMinute TimeSecondNotValidMonth TimeZone[opt] // TimeHour TimeMinute TimeSecond TimeFraction TimeZone[opt] + // NOTE: Reverse order here because `TimeHour TimeZoneNumericUTCOffsetNotAmbiguous[opt] TimeZoneBracketedAnnotation[opt]` can + // be a subset of `TimeHourNotValidMonth TimeZone`, so we'd not attempt to parse that but may not exhaust the input string. + { + StateTransaction transaction { *this }; + if (parse_time_hour_not_valid_month() && parse_time_zone()) { + transaction.commit(); + return true; + } + } { StateTransaction transaction { *this }; if (parse_time_hour()) { @@ -1196,13 +1205,6 @@ bool ISO8601Parser::parse_time_spec_with_optional_time_zone_not_ambiguous() } { StateTransaction transaction { *this }; - if (parse_time_hour_not_valid_month() && parse_time_zone()) { - transaction.commit(); - return true; - } - } - { - StateTransaction transaction { *this }; if (parse_time_hour_minute_basic_format_not_ambiguous()) { (void)parse_time_zone_bracketed_annotation(); transaction.commit(); |