Make Date.parse handle 24:00:00.000 time properly (#3196)

ES5.1 15.9.1.15 Note1 defines that 24:00 is same as 0:00
of the next day. The spec explicitly doesn't mention that
24:01 should be invalid, but it should be self-evident.
(FireFox and Chrome also refuses times bigger than 24:00)

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
This commit is contained in:
Csaba Osztrogonác
2019-10-03 09:49:51 +02:00
committed by Robert Fancsik
parent cd7720ee08
commit 6a848a36fd
2 changed files with 9 additions and 5 deletions
@@ -277,10 +277,6 @@ ecma_builtin_date_parse (ecma_value_t this_arg, /**< this argument */
{
hours = ecma_number_make_nan ();
}
else if (hours == 24)
{
hours = ECMA_NUMBER_ZERO;
}
if (date_str_curr_p < date_str_end_p
&& *date_str_curr_p == ':')
@@ -324,6 +320,11 @@ ecma_builtin_date_parse (ecma_value_t this_arg, /**< this argument */
}
}
if (hours == 24 && (minutes != 0 || seconds != 0 || milliseconds != 0))
{
hours = ecma_number_make_nan ();
}
time = ecma_date_make_time (hours, minutes, seconds, milliseconds);
}
else