JSON.stringify(Date) losts the milliseconds information
Hi 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?
白石俊平 wrote:
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.
On the other hand, a while back I remember looking at a number of date parsing libraries that clearly weren't going to be able to handle milliseconds in RFC 3339 / ISO 8601 formatted dates. At the time, I recommended for the project I worked on that we never generate such dates with the millisecond format. It wasn't critical that we used them, so it was an easy decision for us to discard them. -- Patrick Mueller - http://muellerware.org
Please file a bug:http://webkit.org/quality/reporting.html Ideally one which shows how our behavior differs from other browsers with a nice clear test case. -eric On Sun, Sep 6, 2009 at 10:30 PM, 白石俊平 <shumpei.shiraishi@gmail.com> wrote:
Hi
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? _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Please file a bug:
OK, I filed bug as: https://bugs.webkit.org/show_bug.cgi?id=29063 and, I tested current implementations' behavior and attached test case. thanks. -shumpei On Tue, Sep 8, 2009 at 9:36 PM, Eric Seidel<eric@webkit.org> wrote:
Please file a bug: http://webkit.org/quality/reporting.html Ideally one which shows how our behavior differs from other browsers with a nice clear test case. -eric On Sun, Sep 6, 2009 at 10:30 PM, 白石俊平 <shumpei.shiraishi@gmail.com> wrote:
Hi
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? _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
participants (3)
-
Eric Seidel
-
Patrick Mueller
-
白石俊平