javascript date problem, duplicate one day if use Date.setDate(Calendar.getDate()+1);

RESOLVED DUPLICATE of bug 269424

Status

()

Firefox
General
RESOLVED DUPLICATE of bug 269424
13 years ago
13 years ago

People

(Reporter: Gustavo Henrique Cervi, Assigned: Blake Ross)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; chrome://navigator/locale/navigator.properties; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; chrome://navigator/locale/navigator.properties; rv:1.7.5) Gecko/20041107 Firefox/1.0

A simple script to print a calendar.  
It prints a sequence of days.  
The output must be "1 2 3 4 5 6 7..." but it prints "1 2 3 4 5 6 7 7 8 9".  
The repeated number can move, depending on the machine.

var Calendar = new Date(2005, 9, 1);
for(index=0; index < 31; index++) {
    document.write(Calendar.getDate().toString() + ' ');
    Calendar.setDate(Calendar.getDate()+1);
}


Reproducible: Always

Steps to Reproduce:
1. save this 5 line script on test.htm file
2. load into firefox 1.0 (linux)
3. load into firefox 1.0 (windows)

Actual Results:  
In step 2 (linux), the problem occurs, at least one number will repeat.  
In step 3 (windows), the script works correctly.


An interesting information. This duplication seems to only happen in November.

Comment 1

13 years ago
Another way to see that bug: 
 
alert(new Date(2005,9,14)); // prints 14/oct/2005 OK! 
alert(new Date(2005,9,15)); // prints 15/oct/2005 OK! 
alert(new Date(2005,9,16)); // prints 15/oct/2005 error! 

Comment 2

13 years ago

*** This bug has been marked as a duplicate of 269424 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.