For some reason I need to test current and previous dates with Javascript Date Object. I changed my system time with back date i.e. 25th July 2011 and time 9:00PM. I used following code:
<html>
<head>
<script type="text/javascript">
window.onload = function(){
var d = new Date();
alert("Date = "+ d.toString());
}
</script>
</head>
<body></body>
</html>
If I run the above code in Firefox then the output is:
Date = Mon Jul 25 2011 21:03:06 GMT+0530 (India Standard Time)But if I run the same code in Chrome/Android t开发者_运维技巧hen the output is:
Date = Tue Jul 26 2011 21:03:06 GMT+0530 (India Standard Time)Note: I am using Chrome 12.0.742.122 *Please change your machine's Date.* I am using windows 7
Can somebody tell me what's wrong with Google Chrome with Date? or If can suggest me what should I do to overcome Chrome's behaviour?
Please suggest if I am doing something wrong.
There is an open bug in Chromium regarding this issue.
Seems like it is happening only when you change the time backwards, so maybe you run your test by changing it forward.
精彩评论