Date.prototype.toISOString and fractional parts

Mameri, Fred (HBO) Fred.Mameri at hbo.com
Tue Aug 5 09:07:38 PDT 2014


According to the spec, the toISOString is currently defined to return a string in the format YYYY-MM-DDTHH:mm:ss.sssZ.
Specifically, there's a 3-digit fractional part introduced by a . (that's the ".sss" above) appended to the seconds.

It is my understanding of the ISO8601 spec that fractional parts can start with either a dot or a comma, and that the number of digits in the fractional part needs to be agreed upon by both parties using that format. If my interpretation is correct, the current behavior seems to be problematic, in that if an API accepts more (or fewer) than 3 fractional digits, the result of this function needs to be further modified before they can be used against said API. Same goes for dot vs. comma.

Would it make sense then to augment the spec to have toISOString take optional parameters Date.prototype.toISOString([precision[, separator]])?

Thanks


---------------------------------------------------------------------
This e-mail is intended only for the use of the addressees.  Any copying, forwarding, printing or other use of this e-mail by persons other than the addressees is not authorized.  This e-mail may contain information that is privileged, confidential and exempt from disclosure. If you are not the intended recipient, please notify us immediately by return e-mail (including the original message in your reply) and then delete and discard all copies of the e-mail. 

Thank you.

---------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140805/c0280aeb/attachment-0001.html>


More information about the es-discuss mailing list