My date funciton does work, but if a user types 20 for the year it deafaults to 2020. This really causes problems. Can I require them to type in a four digit year?? This would solve the problem. Below is my code.
function validateBirth(fld, errMsg)
{
var stDate = new Date(fld.value);
today=new Date();
var oneday=10006060*24;
var age = Math.ceil((stDate.getTime()-today.getTime())/(oneday));
if (stDate == “NaN”)
{
alert("Please enter a valid date for " + errMsg + “.”);
fld.focus();
return false;
}
if (age > 0)
{
alert (“Date is in the future”);
return false;
}//endif
return true;
}//endfunction validateBirthdate