Created attachment 39241 [details] Test case for this bug. I tried to use the JSON.stringify() for Date object on Safari4 and WebKit nightly build(48096), so I got result as follows. > JSON.stringify(new Date()); > 2009-09-07T04:49:43Z This result seems that milliseconds information of date is lost. For some applications, millis info is important and this behavior may be problem. And in the ECMAScript 5th specification, Date.toISOString() (this function is called from Date.prototype.toJSON()) is defined as: ...Date Time string format (15.9.1.15). *All fields are present* in the string... So, I think the Webkit's behavior should be treated as a bug, isn't it? P.S. Current implementations' status is as follows (tested by attached test case): Firefox3.5: keep milliseconds Webkit: lost milliseconds Opera10: not yet implemented IE8: lost milliseconds Mmm... IE8's behavior is same as Webkit. Is current behavior collect? Is JSON.stringify() useless for apps which want to treat the information of milliseconds?
> Mmm... IE8's behavior is same as Webkit. > Is current behavior collect? Is JSON.stringify() useless for apps which want to > treat the information of milliseconds? Per spec it is incorrect, but that said, toJSON is a function like any other, eg. Date.prototype.toJSON = function() { ... }
> Per spec it is incorrect, but that said, toJSON is a function like any other, > eg. > Date.prototype.toJSON = function() { > ... > } OK, I see. And I wrote a JS library for ISO-8601 date format. It is useful to implement the custom Date.prototype.toJSON(). http://wiki.github.com/shumpei/iso8601.js/
Created attachment 39250 [details] Patch v1
Comment on attachment 39250 [details] Patch v1 r=me
Landed r48202