开发者

Displaying values for date objects in Google Chrome Developer Tools

Is it possible in Google Chrome's Developer Tools (Developer -> Developer Tools or ctrl+shift+i) when inspecting script's date variables to see their values?

For example, Google Chrome:

end_date: Date
start_date: Date

Firefox:

end_date: Mon Nov 01 2010 00:00:00 GMT+0200 {}
start_date: Fri Oct 01 2010 00:00:00 GMT+0300 {}

This problem can be solved in C开发者_StackOverflowhrome by adding new watch: date_object.toString() but that is not really convenient, maybe there is some other way?

Update: Sorry i didn't specify it in the original question - date is not displayed on the Scripts tab in the 'Watch expressions', 'Scope variables' sections.


I'm not quite understand your question. As I can see the debugger is showing the Date in format you want.

Could you please provide a use case for your problem.

Displaying values for date objects in Google Chrome Developer Tools

<html>
<title>test</title>
<head>
<script>
function test()
{
    var t = new Date();
}
setTimeout(test, 1000);
</script>
</head>
<body>
</body>

</html>


There is a WebKit's bug (again at 2011-11-05): https://bugs.webkit.org/show_bug.cgi?id=71605

So just add ".toString()" to a watching variable:

Displaying values for date objects in Google Chrome Developer Tools

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜