Date.prototype.toISOString and Invalid Date

Brendan Eich brendan at
Wed Jun 10 09:42:22 PDT 2009

On Jun 10, 2009, at 8:48 AM, Allen Wirfs-Brock wrote:

> I believe that support for ISO dates in ES5 is intended to provide a  
> standard interchange format for dates, not for providing a locale  
> customized format for human consumption.  Since ISO 8601 apparently  
> doesn't provide an encoding for "invalid date/time", arguably new  
> Date(NaN).toISOString() should never be passed to someone expecting  
> a valid ISO date. If that is true, then be best thing to do may be  
> to specify that toISOString throws a RangeError when applied to such  
> Date objects.

+1, or more.


More information about the es5-discuss mailing list