Feedback on: irt.org FAQ Knowledge Base Q29
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())
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.
Worth:
Worth reading
Comments:
for Netscape users:
if(navigator.appName == 'Netscape') { yearNow = yearNow + 1900 }
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
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
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
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());
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.
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?