diff options
author | Linus Groh <mail@linusgroh.de> | 2022-07-05 19:49:17 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-07-05 23:15:52 +0200 |
commit | 7ef3b426853fc941d416d413659ced12f2bf4c1d (patch) | |
tree | 5fdaed706e706bbd98ddd1d2ad4c10a0479329c5 /Userland | |
parent | fec5d8d5310000fc95cfffa7d1ef20ecd0d29c01 (diff) | |
download | serenity-7ef3b426853fc941d416d413659ced12f2bf4c1d.zip |
LibJS: Simplify TimeZoneNumericUTCOffsetNotAmbiguous
This is an editorial change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/ccef468
- https://github.com/tc39/proposal-temporal/commit/5b38ab4
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp index de2746ee04..ee070087c2 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp @@ -769,36 +769,13 @@ bool ISO8601Parser::parse_time_zone_utc_offset() bool ISO8601Parser::parse_time_zone_numeric_utc_offset_not_ambiguous() { // TimeZoneNumericUTCOffsetNotAmbiguous : - // + TimeZoneUTCOffsetHour - // U+2212 TimeZoneUTCOffsetHour - // TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour : TimeZoneUTCOffsetMinute - // TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour TimeZoneUTCOffsetMinute - // TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour : TimeZoneUTCOffsetMinute : TimeZoneUTCOffsetSecond TimeZoneUTCOffsetFraction[opt] - // TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour TimeZoneUTCOffsetMinute TimeZoneUTCOffsetSecond TimeZoneUTCOffsetFraction[opt] + // TimeZoneNumericUTCOffset but not - TimeZoneUTCOffsetHour StateTransaction transaction { *this }; - if (m_state.lexer.consume_specific('+') || m_state.lexer.consume_specific("\xE2\x88\x92"sv)) { - if (!parse_time_zone_utc_offset_hour()) - return false; - } else { - if (!parse_time_zone_utc_offset_sign()) - return false; - if (!parse_time_zone_utc_offset_hour()) - return false; - if (m_state.lexer.consume_specific(':')) { - if (!parse_time_zone_utc_offset_minute()) - return false; - if (m_state.lexer.consume_specific(':')) { - if (!parse_time_zone_utc_offset_second()) - return false; - (void)parse_time_zone_utc_offset_fraction(); - } - } else { - if (!parse_time_zone_utc_offset_minute()) - return false; - if (parse_time_zone_utc_offset_second()) - (void)parse_time_zone_utc_offset_fraction(); - } - } + if (!parse_time_zone_numeric_utc_offset()) + return false; + auto parsed = *m_state.parse_result.time_zone_numeric_utc_offset; + if (parsed.length() == 3 && parsed[0] == '-') + return false; transaction.commit(); return true; } |