Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date object in Netscape 4.75 on Solaris -- Buggy? 2

Status
Not open for further replies.

mxwing

Programmer
Mar 20, 2001
1
US
Hi.

I'm running Netscape 4.75 on Solaris and
it seems the JavaScript Date object has
problems with dates (years) >= 2000.
Specifically, when I call getYear()
on a Date object whose year is 2000
it returns 100. If the year is 2001,
it returns 101.

This happens whether I create the Date
object using a datestring or the year,
month, day as args.

If this is a known bug, does anyone know
if it's fixed in a more current version?

Thanks.
 
This is common among code that used a two-digit date. 1999 was 99. 2000 is 1999 + 1, which is treated as 99 + 1 = 100. 2001 is 1999 + 2, which is treated as 99 + 2 = 101. Obviously that version is not fully Y2K compliant. Did you try using GetFullYear? Don't know if it works in that version of NS or not, but it's worth a try. Otherwise just add 1900 to the year you get back. If you need only two digits add 1900, convert to a string, and substring out the last two digits.
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Hi,

Netscape does have problem with the date.getyear call from javascript....the only way you can do is to have it search the application and see if it's netscape 4.10 and have it automatically add 1900, since netscape gets the offset of 1900.

Here is some of the code, it might help you out.
if(document.layers)
if(parseFloat(navigator.appVersion) > 4.07)
var fixed_year = the_year + 1900;
else
var fixed_year = the_year;

Thanks,
Hui
 
i forgot to meantion it to you, that any version above 4.07 get an offset of 1900, the version before takes the full year...i don't know why netscape did it that way, i guess they wanted to be special......

mozilla :p

Hui
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top