Skip to content

Commit 9c55921

Browse files
LaszloLangoLango
authored andcommitted
Primitive value of Date.prototype should be NaN
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
1 parent 122e5c4 commit 9c55921

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

jerry-core/ecma/builtin-objects/ecma-builtins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */
159159
case ECMA_BUILTIN_ID_DATE_PROTOTYPE:
160160
{
161161
ecma_number_t *prim_prop_num_value_p = ecma_alloc_number ();
162-
*prim_prop_num_value_p = ECMA_NUMBER_ZERO;
162+
*prim_prop_num_value_p = ecma_number_make_nan ();
163163

164164
ecma_property_t *prim_value_prop_p;
165165
prim_value_prop_p = ecma_create_internal_property (object_obj_p,

tests/jerry/date-construct.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ catch (e)
2929
assert (e.message === "foo");
3030
}
3131

32+
assert (isNaN(Date.prototype.valueOf.call(Date.prototype)));
33+
3234
d = Date("abcd");
3335
assert (isNaN(d.valueOf()));
3436

0 commit comments

Comments
 (0)