« Return to Thread: Date.prototype.toISOString and Invalid Date

Re: Date.prototype.toISOString and Invalid Date

by Christian Plesner Hansen-3 :: Rate this Message:

Reply to Author | View in Thread

If the spec says that toISOString() must return a certain value that
doesn't parse according to 15.9.1.15 maybe, for symmetry, it should
also say what Date.parse should do when passed that value?

On Wed, Jun 10, 2009 at 3:06 AM, Allen
Wirfs-Brock<Allen.Wirfs-Brock@...> wrote:

> Currently, implementations are inconsistent about what they produce for (new Date(NaN).toString()).
> IE and Opera produce "NaN", while FF and Safari produce "Invalid Date".
>
> Since toISOString is a new function, we have the opportunity to specify what we want the result to be.
>
> Does anybody have an opinion. It could be either "NaN" or "Invalid Date" or something else. "Invalid Date" has the advantage that it is more end-user meaningful if it actually leaks through to be visible on a web page (although that is a pretty Anglo-centric perspective).
>
> Unless, I here strong opinions otherwise I think I'll go with "Invalid Date".
>
> Allen
>
>>-----Original Message-----
>>From: es-discuss-bounces@... [mailto:es-discuss-
>>bounces@...] On Behalf Of Garrett Smith
>>Sent: Saturday, June 06, 2009 12:40 AM
>>To: es-discuss
>>Subject: Date.prototype.toISOString and Invalid Date
>>
>>What is the expected result of calling toISOString on a date where the
>>year is NaN?
>>
>>var d = new Date(NaN);
>>d.toISOString();
>>
>>?
>>
>>Garrett
>>_______________________________________________
>>es-discuss mailing list
>>es-discuss@...
>>https://mail.mozilla.org/listinfo/es-discuss
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@...
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
es-discuss@...
https://mail.mozilla.org/listinfo/es-discuss

 « Return to Thread: Date.prototype.toISOString and Invalid Date