summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-07-05 19:49:17 +0200
committerLinus Groh <mail@linusgroh.de>2022-07-05 23:15:52 +0200
commit7ef3b426853fc941d416d413659ced12f2bf4c1d (patch)
tree5fdaed706e706bbd98ddd1d2ad4c10a0479329c5 /Userland
parentfec5d8d5310000fc95cfffa7d1ef20ecd0d29c01 (diff)
downloadserenity-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.cpp35
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;
}