diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c index fb11bf834..d0111bc7b 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c @@ -202,7 +202,7 @@ ecma_builtin_date_prototype_to_primitive (ecma_value_t this_arg, /**< this argum { ecma_string_t *hint_str_p = ecma_get_string_from_value (hint_arg); - ecma_preferred_type_hint_t hint = ECMA_PREFERRED_TYPE_NUMBER; + ecma_preferred_type_hint_t hint = ECMA_PREFERRED_TYPE_NO; if (hint_str_p == ecma_get_magic_string (LIT_MAGIC_STRING_STRING) || hint_str_p == ecma_get_magic_string (LIT_MAGIC_STRING_DEFAULT)) diff --git a/tests/jerry/es.next/date-prototype-toprimitive.js b/tests/jerry/es.next/date-prototype-toprimitive.js index 7ee4509f9..f20a5afb7 100644 --- a/tests/jerry/es.next/date-prototype-toprimitive.js +++ b/tests/jerry/es.next/date-prototype-toprimitive.js @@ -42,6 +42,14 @@ try { assert(e instanceof TypeError); } +// Test with invalid hint value +try { + dateObj[Symbol.toPrimitive]('error'); + assert(false); +} catch (e) { + assert(e instanceof TypeError); +} + // Test when unable to call toPrimitive try { Date.prototype[Symbol.toPrimitive].call(undefined); diff --git a/tests/test262-es6-excludelist.xml b/tests/test262-es6-excludelist.xml index 0fc826d6d..ac677670a 100644 --- a/tests/test262-es6-excludelist.xml +++ b/tests/test262-es6-excludelist.xml @@ -27,7 +27,6 @@ -