Re: Date is wrong in javascript

by "Harold A. Driscoll" <harold(at)driscoll.chi.il.us>

 Date:  Sun, 09 Jan 2000 02:50:12 -0600
 To:  cbirds(at)earthlink.net
 Cc:  hwg-techniques(at)mail.hwg.org
 References: 
  todo: View Thread, Original
At 19:10 08-01-00 , Jane wrote:
>How can I correct the following code so that the 
>date does not read 1/9/100?

getYear() is defined to return the number of years since 1900, so the fix
is to add 1900 to it (or take a modula-100 for just two-digit.

An added gotcha is that M$-IE is broken, returning the year 3900 (rather
than 2000). My suggestion is to test for current year > say 2100 and
suggest that the user upgrade to a calendar-compliant browser... but you
may want to put in a hack to accommodate the broken browser behavior.

Your code, your call... just remember to display reasonable results for the
increasing number of us who know that JavaScript is a serious security hole
and wisely have it disabled. <G>

Safe computing,  /Harold
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Harold A. Driscoll                 mailto:Harold(at)Driscoll.Chi.IL.US
#include <std/disclaimer>                 http://Driscoll.Chi.IL.US

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.