Vermelh0
07-31-2002, 10:34 PM
I've been pouring hours into a script, wondering why it was no longer working and then I figured "wait a minute, maybe it's not my fault." And guess what, it isn't. I think I've been able to isolate the bug, but why does it happen? The problem is with the IE's date object and todays date 2002-07-31. The set/get month functions go haywire and do not return proper values.
Here's a sample function:
function doanything()
{
today = new Date(2002, 07, 31, 0, 0, 0);
today.setMonth(10);
alert(today.getDate()+'/'+(today.getMonth()+1)+'/'+today.getFullYear());
today.setMonth(9);
alert(today.getDate()+'/'+(today.getMonth()+1)+'/'+today.getFullYear());
}
The first alert box returns 1-12-2002 and the second 1-10-2002.
As you can see the first date is off by one..... If I initialize the date to another date say 2002-07-30, the problem goes away.
Hum... My head hursts..... What others bugs should I be on the lookout on IE?
V
Here's a sample function:
function doanything()
{
today = new Date(2002, 07, 31, 0, 0, 0);
today.setMonth(10);
alert(today.getDate()+'/'+(today.getMonth()+1)+'/'+today.getFullYear());
today.setMonth(9);
alert(today.getDate()+'/'+(today.getMonth()+1)+'/'+today.getFullYear());
}
The first alert box returns 1-12-2002 and the second 1-10-2002.
As you can see the first date is off by one..... If I initialize the date to another date say 2002-07-30, the problem goes away.
Hum... My head hursts..... What others bugs should I be on the lookout on IE?
V