mirror of
https://github.com/RGBCube/serenity
synced 2025-07-19 13:17:39 +00:00
LibJS: Disallow date-only strings for PlainTime
This is a normative change in the Temporal spec.
See: b16a296
This commit is contained in:
parent
6da6da73cc
commit
01eefc344a
2 changed files with 20 additions and 3 deletions
|
@ -834,6 +834,22 @@ bool ISO8601Parser::parse_calendar_date_time()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://tc39.es/proposal-temporal/#prod-CalendarDateTimeTimeRequired
|
||||||
|
bool ISO8601Parser::parse_calendar_date_time_time_required()
|
||||||
|
{
|
||||||
|
// CalendarDateTimeTimeRequired :
|
||||||
|
// Date TimeSpecSeparator TimeZone[opt] Calendar[opt]
|
||||||
|
StateTransaction transaction { *this };
|
||||||
|
if (!parse_date())
|
||||||
|
return false;
|
||||||
|
if (!parse_time_spec_separator())
|
||||||
|
return false;
|
||||||
|
(void)parse_time_zone();
|
||||||
|
(void)parse_calendar();
|
||||||
|
transaction.commit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// https://tc39.es/proposal-temporal/#prod-DurationWholeSeconds
|
// https://tc39.es/proposal-temporal/#prod-DurationWholeSeconds
|
||||||
bool ISO8601Parser::parse_duration_whole_seconds()
|
bool ISO8601Parser::parse_duration_whole_seconds()
|
||||||
{
|
{
|
||||||
|
@ -1189,10 +1205,10 @@ bool ISO8601Parser::parse_temporal_time_string()
|
||||||
{
|
{
|
||||||
// TemporalTimeString :
|
// TemporalTimeString :
|
||||||
// CalendarTime
|
// CalendarTime
|
||||||
// CalendarDateTime
|
// CalendarDateTimeTimeRequired
|
||||||
// NOTE: Reverse order here because `Time` can be a subset of `DateTime`,
|
// NOTE: Reverse order here because `Time` can be a subset of `CalendarDateTimeTimeRequired`,
|
||||||
// so we'd not attempt to parse that but may not exhaust the input string.
|
// so we'd not attempt to parse that but may not exhaust the input string.
|
||||||
return parse_calendar_date_time()
|
return parse_calendar_date_time_time_required()
|
||||||
|| parse_calendar_time();
|
|| parse_calendar_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,7 @@ public:
|
||||||
[[nodiscard]] bool parse_date_time();
|
[[nodiscard]] bool parse_date_time();
|
||||||
[[nodiscard]] bool parse_calendar_time();
|
[[nodiscard]] bool parse_calendar_time();
|
||||||
[[nodiscard]] bool parse_calendar_date_time();
|
[[nodiscard]] bool parse_calendar_date_time();
|
||||||
|
[[nodiscard]] bool parse_calendar_date_time_time_required();
|
||||||
[[nodiscard]] bool parse_duration_whole_seconds();
|
[[nodiscard]] bool parse_duration_whole_seconds();
|
||||||
[[nodiscard]] bool parse_duration_seconds_fraction();
|
[[nodiscard]] bool parse_duration_seconds_fraction();
|
||||||
[[nodiscard]] bool parse_duration_seconds_part();
|
[[nodiscard]] bool parse_duration_seconds_part();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue