On Sun, Jan 02, 2000 at 09:07:45PM +1100, Andrew Macks wrote:
> On a similar, and more serious note, it seems there is a big browser
> issue with the Year 2000.
> 
> Netscape and IE can return the date as 2 digits in javascript.  A lot of
> sites use this to display the date on their site.
> 
> Unfortunately, when 99 switched over, Netscape made it 100 and IE made it
> 2000 :)  So now it's 3900 according to a LOT of sites in IE :)  But 2000
> according to Netscape :)

This is mainly caused by the javascript spec being changed somewhere 
alone the line.

Javascript 1.2 will return a two digit year between 1900 and 1999, but a
4 digit year at other times. ie, 1999 will be 99, but 2000 will be 2000.

Javascript 1.3 will return the number of years since 1900, even if it's
negative. ie, 1999 will be 99, and 2000 will be 100.

The problem is that IE is acting as per the js1.2 spec, whilst Netscape is
acting as per the js1.3 spec.

It's a fairly simple fix to do some form of sanity checking on the result
to get around the problem.  Something as simple as  if year < 500 add 1900
will do the job quite well.

  Scott.
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to [EMAIL PROTECTED] with
unsubscribe in the text

Reply via email to