-
Sub-task
-
Resolution: Fixed
-
P4
-
None
-
None
-
b86
-
generic
-
generic
-
Verified
Two related issues:
* Date.prototype.toJSON should call toISOString override by user.
* Date.prototype.setFOO methods should convert all arguments by ToNumber - which calls user defined valueOf as needed. This should be done even if a specific argument fails to convert. Subsequent args should be converted for possible valueOf side-effects.
Examples:
(new Date).setFullYear({valueOf:function(){print("year"); return NaN}}, {valueOf: function(){print("month"); return NaN}})
=> should print "year" and "month"
(d = new Date(), d.toISOString = function(){return "test"}, d.toJSON())
=> should return "test"
* Date.prototype.toJSON should call toISOString override by user.
* Date.prototype.setFOO methods should convert all arguments by ToNumber - which calls user defined valueOf as needed. This should be done even if a specific argument fails to convert. Subsequent args should be converted for possible valueOf side-effects.
Examples:
(new Date).setFullYear({valueOf:function(){print("year"); return NaN}}, {valueOf: function(){print("month"); return NaN}})
=> should print "year" and "month"
(d = new Date(), d.toISOString = function(){return "test"}, d.toJSON())
=> should return "test"