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
+4 -1
View File
@@ -36,6 +36,9 @@ var wrongFormats = ["",
"2015-01-01T00:",
"2015-01-01T00:00:00.1",
"2015-01-01T00:00:00.01",
"2015-01-01T24:01:00.000",
"2015-01-01T24:00:01.000",
"2015-01-01T24:00:00.001",
"2015-01-01T00:00+01:00Z",
"2015/01/01",
"2015-01-32",
@@ -93,7 +96,7 @@ d = Date.parse("2015-01T00:00:00.000");
assert (d == 1420070400000);
d = Date.parse("2015-01T24:00:00.000");
assert (d == 1420070400000);
assert (d == 1420156800000);
d = Date.parse("2015-01T00:00:00.000+03:00");
assert (d == 1420059600000);