Date.prototype.toISOString and Invalid Date
Allen.Wirfs-Brock at microsoft.com
Wed Jun 10 11:00:12 PDT 2009
This would also imply that (new Date(NaN).toJSON()) also throws. Is everybody fine with that??
>From: Brendan Eich [mailto:brendan at mozilla.com]
>Sent: Wednesday, June 10, 2009 9:42 AM
>To: Allen Wirfs-Brock
>Cc: John Cowan; Adam Peller; es-discuss at mozilla.org; es5-
>discuss at mozilla.org
>Subject: Re: Date.prototype.toISOString and Invalid Date
>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 es-discuss