mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
LibJS: Simplify TimeZoneNumericUTCOffsetNotAmbiguous
This is an editorial change in the Temporal spec. See: -ccef468
-5b38ab4
This commit is contained in:
parent
fec5d8d531
commit
7ef3b42685
1 changed files with 6 additions and 29 deletions
|
@ -769,36 +769,13 @@ bool ISO8601Parser::parse_time_zone_utc_offset()
|
||||||
bool ISO8601Parser::parse_time_zone_numeric_utc_offset_not_ambiguous()
|
bool ISO8601Parser::parse_time_zone_numeric_utc_offset_not_ambiguous()
|
||||||
{
|
{
|
||||||
// TimeZoneNumericUTCOffsetNotAmbiguous :
|
// TimeZoneNumericUTCOffsetNotAmbiguous :
|
||||||
// + TimeZoneUTCOffsetHour
|
// TimeZoneNumericUTCOffset but not - TimeZoneUTCOffsetHour
|
||||||
// U+2212 TimeZoneUTCOffsetHour
|
|
||||||
// TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour : TimeZoneUTCOffsetMinute
|
|
||||||
// TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour TimeZoneUTCOffsetMinute
|
|
||||||
// TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour : TimeZoneUTCOffsetMinute : TimeZoneUTCOffsetSecond TimeZoneUTCOffsetFraction[opt]
|
|
||||||
// TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour TimeZoneUTCOffsetMinute TimeZoneUTCOffsetSecond TimeZoneUTCOffsetFraction[opt]
|
|
||||||
StateTransaction transaction { *this };
|
StateTransaction transaction { *this };
|
||||||
if (m_state.lexer.consume_specific('+') || m_state.lexer.consume_specific("\xE2\x88\x92"sv)) {
|
if (!parse_time_zone_numeric_utc_offset())
|
||||||
if (!parse_time_zone_utc_offset_hour())
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
auto parsed = *m_state.parse_result.time_zone_numeric_utc_offset;
|
||||||
if (!parse_time_zone_utc_offset_sign())
|
if (parsed.length() == 3 && parsed[0] == '-')
|
||||||
return false;
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue