Date.prototype.toISOString and Invalid Date

Adam Peller apeller at us.ibm.com
Wed Jun 10 07:59:23 PDT 2009


I don't feel strongly on this, but it does strike me as odd that a function
intended to avoid culturally-sensitive output would use an English phrase.
I'd lean towards IE/Opera, using notation from ECMAScript that is equally
cryptic to all cultures :-)  At least that would be consistent with
Number.toString() and would reinforce the fact that there are other methods
to produce strings in the user's locale.

Are there English phrases specified anywhere else for output?

-Adam



                                                                           
             Allen Wirfs-Brock                                             
             <Allen.Wirfs-Broc                                             
             k at microsoft.com>                                           To 
             Sent by:                  "es5-discuss at mozilla.org"           
             es5-discuss-bounc         <es5-discuss at mozilla.org>,          
             es at mozilla.org            "es-discuss at mozilla.org"            
                                       <es-discuss at mozilla.org>            
                                                                        cc 
             06/09/2009 09:06          Garrett Smith                       
             PM                        <dhtmlkitchen at gmail.com>            
                                                                   Subject 
                                       RE: Date.prototype.toISOString and  
                                       Invalid Date                        
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




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 at mozilla.org [mailto:es-discuss-
>bounces at mozilla.org] 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 at mozilla.org
>https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es5-discuss mailing list
es5-discuss at mozilla.org
https://mail.mozilla.org/listinfo/es5-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090610/b16b5449/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090610/b16b5449/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic05120.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090610/b16b5449/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090610/b16b5449/attachment-0002.gif>


More information about the es-discuss mailing list