Fix primitive value handling in Date constructor

JerryScript-DCO-1.0-Signed-off-by: Kristof Kosztyo kkosztyo.u-szeged@partner.samsung.com
This commit is contained in:
Kristof Kosztyo
2015-07-27 13:08:58 +02:00
parent 801e8e34cd
commit 8cd1ade515
2 changed files with 7 additions and 1 deletions
@@ -529,7 +529,7 @@ ecma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**<
ECMA_TRY_CATCH (prim_value, ecma_op_to_number (arguments_list_p[0]), ret_value);
prim_value_num_p = ecma_alloc_number ();
*prim_value_num_p = *ecma_get_number_from_value (prim_value);
*prim_value_num_p = ecma_date_time_clip (*ecma_get_number_from_value (prim_value));
ECMA_FINALIZE (prim_value);
}
+6
View File
@@ -57,3 +57,9 @@ assert (d.valueOf() == 1420070400000);
d = new Date(2015,0,1,0,0,0,0);
assert (d.valueOf() == 1420070400000);
d = new Date(8.64e+15);
assert (d.valueOf() == 8.64e+15);
d = new Date(8.64e+15 + 1);
assert (isNaN(d.valueOf()));