Date class of JavaScript is not reflected correctly.

RESOLVED INVALID

Status

()

Firefox
General
--
major
RESOLVED INVALID
7 years ago
7 years ago

People

(Reporter: tankinguard, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; ja; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; ja; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8

The date inputted into the Date class is not stored exactly. 

Reproducible: Always

Steps to Reproduce:
Execute the following scripts.
<html>
<body>
<script type="text/javascript">
var d = new Date(2010,8,31,0,0,0);
document.write(d.toString() + "<br>");
d = new Date(2010,9,1,0,0,0);
document.write(d.toString() + "<br>");
d = new Date(2010,12,30,0,0,0);
document.write(d.toString() + "<br>");
</script>
</body>
</html>
Actual Results:  
Fri Oct 01 2010 00:00:00 GMT+0900
Fri Oct 01 2010 00:00:00 GMT+0900
Sun Jan 30 2011 00:00:00 GMT+0900

Expected Results:  
Tue Aug 31 2010 00:00:00 GMT+0900
Fri Oct 01 2010 00:00:00 GMT+0900
Thu Dec 30 2010 00:00:00 GMT+0900

I think that there is a Problem in "jsdate.c" of SpiderMonkey.
months in javascript start from 0 so the first date is 31st September which doesn't exist. 1 October seems a reasonable substitution doesn't it?

Same with the other dates.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.