Rationale behind supporting "Invalid Date"

Andrew Paprocki andrew at ishiboo.com
Sun Feb 12 10:49:13 PST 2012

On Sat, Feb 11, 2012 at 8:32 PM, Brendan Eich <brendan at mozilla.com> wrote:
> It's well-specified by etc.

I was reading http://es5.github.com/x15.9.html and I see the spec for
allowing NaN as the "this time value". Where did the "Invalid Date"
toString() came from? I don't see it on that page at all, yet all the
browsers seem to return it.

> This is all based on java.util.Date from ages ago, sorry it is painful. Have
> you considered wrapping Date with a user-defined function that throws if an
> invalid Date with a NaN time-value is created? Something like this:

I was thinking of trying it out when running in a "debug" mode to help
catch errors. Is there any actual real use in the wild for a Date with
a NaN value?


More information about the es-discuss mailing list