Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: irt.org FAQ Knowledge Base Q29

Feedback on: irt.org FAQ Knowledge Base Q29

Sent by g simpson on May 15, 2000 at 07:47:40: - feedback #1227

Worth:
Very worth reading

Comments:
could improve the accuracy by replacing the 31 with the actual number of days in the month.

(32 - new Date(yearDob, monthDob, 32).getDate())


Sent by Yun-dong on August 08, 2001 at 14:37:38: - feedback #3064

Worth:
Very worth reading

Comments:
Wonderful! I don't need to write my own function, but should change getYear() to getFullYear() to fix y2k problem. Thanks.


Sent by Lungren McPatu on November 28, 2001 at 10:35:59: - feedback #3375

Worth:
Worth reading

Comments:
for Netscape users:

if(navigator.appName == 'Netscape') { yearNow = yearNow + 1900 }


Sent by Stephen Oskoui on December 15, 2001 at 10:18:02: - feedback #3424

Worth:
Worth reading

Comments:
There is a bug in this code, because of the way getYear() works.

It returns a 4 digit value for years greater than 1999, but a 2 digit value for years earlier than 2000.

THIS SHOULD BE CHANGED:
var yearDob = dob.getYear();

TO THIS:
var yearDob = dob.getYear();
if (yearDob < 100) yearDob = yearDob + 1900


Sent by David Chase on April 07, 2002 at 15:09:26: - feedback #3757

Technical:
Just right

Comments:
This is what I got???

1937 years 3 months 3 days
1937 years 3 months 3 days
1937 years 3 months 3 days
1937 years 3 months 3 days



Sent by Bob Winn on April 29, 2002 at 10:53:30: - feedback #3820

Length:
Just right

Comments:
There is an error in the script.

Here is my fix:

var yearNow = now.getYear();
var monthNow = now.getMonth(); // Bug fixed
// The 2nd statement was incomplete



Sent by michel on May 05, 2002 at 04:23:50: - feedback #3836

Comments:
Needs a fix for the year>2000 "feature"

function y2k(year) {
return (year<1900)? year+=1900:year;
}

change to

var now = new Date();
var yearNow = y2k(now.getYear());
var monthNow = now.getMonth();
var dateNow = now.getDate();

var today = new Date(yearNow,monthNow,dateNow,0,0,0); // midnight earlier today


and

var yearDob = y2k(dob.getYear());


Sent by Pat Richard on July 29, 2002 at 18:41:30: - feedback #4035

Worth:
Worth reading

Comments:
There is an error in your script. If you attempt to use a birthdate from the 1900's, you get an inacurrate reading (I know I'm not 1936 years old!).

Here is the fix:
Under the line that reads:

var yearDob = dob.getYear();

add the following:

if (yearDob < 2000){
yearDob = yearDob +1900;
}

problem solved. The correct age is now displayed.


Sent by Mohamed on Sunday September 16, 2007 at 13:03:36 - feedback #5032

Worth:
Worth reading

Length:

Technical:
Not technical enough

Comments:
How can this script be modified so that users do not have click that annoying "allow activeX content" on their Internet Explorer?




©2018 Martin Webb