Fix Date.parse to handle times without timezone properly (#4249)
https://www.ecma-international.org/ecma-262/11.0/#sec-date.parse "When the UTC offset representation is absent, date-only forms are interpreted as a UTC time and date-time forms are interpreted as a local time." JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
This commit is contained in:
committed by
GitHub
parent
e227634b45
commit
8fe3891b15
@@ -98,17 +98,19 @@ assert (d == 1420070400000);
|
||||
d = Date.parse("2015-01-01");
|
||||
assert (d == 1420070400000);
|
||||
|
||||
var timezoneOffsetMS = new Date(0).getTimezoneOffset() * 60000;
|
||||
|
||||
d = Date.parse("2015-01T00:00");
|
||||
assert (d == 1420070400000);
|
||||
assert (d == 1420070400000 + timezoneOffsetMS);
|
||||
|
||||
d = Date.parse("2015-01T00:00:00");
|
||||
assert (d == 1420070400000);
|
||||
assert (d == 1420070400000 + timezoneOffsetMS);
|
||||
|
||||
d = Date.parse("2015-01T00:00:00.000");
|
||||
assert (d == 1420070400000);
|
||||
assert (d == 1420070400000 + timezoneOffsetMS);
|
||||
|
||||
d = Date.parse("2015-01T24:00:00.000");
|
||||
assert (d == 1420156800000);
|
||||
assert (d == 1420156800000 + timezoneOffsetMS);
|
||||
|
||||
d = Date.parse("2015-01T00:00:00.000+03:00");
|
||||
assert (d == 1420059600000);
|
||||
|
||||
@@ -695,7 +695,6 @@
|
||||
<test id="built-ins/DataView/toindex-byteoffset-sab.js"><reason></reason></test>
|
||||
<test id="built-ins/DataView/toindex-byteoffset.js"><reason></reason></test>
|
||||
<test id="built-ins/Date/parse/time-value-maximum-range.js"><reason></reason></test>
|
||||
<test id="built-ins/Date/parse/without-utc-offset.js"><reason></reason></test>
|
||||
<test id="built-ins/Date/proto-from-ctor-realm-one.js"><reason></reason></test>
|
||||
<test id="built-ins/Date/proto-from-ctor-realm-two.js"><reason></reason></test>
|
||||
<test id="built-ins/Date/proto-from-ctor-realm-zero.js"><reason></reason></test>
|
||||
|
||||
Reference in New Issue
Block a user