Date.prototype.toISOString and Invalid Date
apeller at us.ibm.com
Wed Jun 10 20:56:41 PDT 2009
Douglas Crockford writes:
>Adam Peller scripsit:
>> 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.
>I think this is what exceptions are for.
>An English string makes little sense.
>NaN is nonsense.
For toISOString I also favor an exception. The toString reference threw me
off, since toString would not be able to throw in the invalid case and
remain compatible. toString Implementations could certainly call
toISOString, catch the exception, and choose some nonsensical, unspecified
replacement, in which case we don't address the browser deviations, and
that's probably fine. At one point, I think we discussed providing
guidance for toString implementations to use toISOString. Was that deemed
too likely to cause compatibility issues, or is it better to just leave the
specification open here?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss