diff --git a/Userland/Libraries/LibJS/Runtime/Date.cpp b/Userland/Libraries/LibJS/Runtime/Date.cpp index b4c80a94241..b36ff27bbcd 100644 --- a/Userland/Libraries/LibJS/Runtime/Date.cpp +++ b/Userland/Libraries/LibJS/Runtime/Date.cpp @@ -608,21 +608,21 @@ bool is_time_zone_offset_string(StringView offset_string) // 21.4.1.33.2 ParseTimeZoneOffsetString ( offsetString ), https://tc39.es/ecma262/#sec-parsetimezoneoffsetstring double parse_time_zone_offset_string(StringView offset_string) { - // 1. Let parseResult be ParseText(StringToCodePoints(offsetString), UTCOffset). + // 1. Let parseResult be ParseText(offsetString, UTCOffset). auto parse_result = Temporal::parse_iso8601(Temporal::Production::TimeZoneNumericUTCOffset, offset_string); // 2. Assert: parseResult is not a List of errors. VERIFY(parse_result.has_value()); - // 3. Assert: parseResult contains a TemporalSign Parse Node. + // 3. Assert: parseResult contains a ASCIISign Parse Node. VERIFY(parse_result->time_zone_utc_offset_sign.has_value()); - // 4. Let parsedSign be the source text matched by the TemporalSign Parse Node contained within parseResult. + // 4. Let parsedSign be the source text matched by the ASCIISign Parse Node contained within parseResult. auto parsed_sign = *parse_result->time_zone_utc_offset_sign; i8 sign { 0 }; - // 5. If parsedSign is the single code point U+002D (HYPHEN-MINUS) or U+2212 (MINUS SIGN), then - if (parsed_sign.is_one_of("-"sv, "\xE2\x88\x92"sv)) { + // 5. If parsedSign is the single code point U+002D (HYPHEN-MINUS), then + if (parsed_sign == "-"sv) { // a. Let sign be -1. sign = -1; } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp index bd1357cf6be..b7542bd53c7 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp @@ -64,11 +64,8 @@ bool ISO8601Parser::parse_sign() { // Sign : // ASCIISign - // U+2212 StateTransaction transaction { *this }; - auto success = parse_ascii_sign() - || m_state.lexer.consume_specific("\xE2\x88\x92"sv); - if (!success) + if (!parse_ascii_sign()) return false; m_state.parse_result.sign = transaction.parsed_string_view(); transaction.commit(); diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.js index 89979acb3d3..dd5c594803c 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.js @@ -16,9 +16,14 @@ describe("errors", () => { expect(() => { new Temporal.TimeZone("0123456"); }).toThrowWithMessage(RangeError, "Invalid time zone name '0123456'"); + expect(() => { new Temporal.TimeZone("23:59:59.9999999999"); }).toThrowWithMessage(RangeError, "Invalid time zone name '23:59:59.9999999999'"); + + expect(() => { + new Temporal.TimeZone("\u221201"); + }).toThrowWithMessage(RangeError, "Invalid time zone name '\u221201'"); }); }); @@ -58,7 +63,6 @@ describe("normal behavior", () => { const signs = [ ["+", "+"], ["-", "-"], - ["\u2212", "-"], ]; const values = [ ["01", "01:00"],