baronne
Technical User
- May 31, 2003
- 166
Hi,
can anyone help me with a simple bit of javascript?
I need to modify the following code for a date of birth selector to return false if they date of birth is less than 18 years old.
jQuery.validator.addMethod("validDOB", function (str1, element) {
var mon1 = parseInt(str1.substring(0,2),10);
var dt1 = parseInt(str1.substring(3,5),10);
var yr1 = parseInt(str1.substring(6,10),10);
var date1 = new Date(parseInt(yr1), parseInt(mon1)-1, parseInt(dt1));
var date2 = new Date();
if(date2 < date1)
{
return false;
}
else
{
return true;
}
}, "Please enter valid date of birth");
:: baronne
------------------
"lekker, shot bru
can anyone help me with a simple bit of javascript?
I need to modify the following code for a date of birth selector to return false if they date of birth is less than 18 years old.
jQuery.validator.addMethod("validDOB", function (str1, element) {
var mon1 = parseInt(str1.substring(0,2),10);
var dt1 = parseInt(str1.substring(3,5),10);
var yr1 = parseInt(str1.substring(6,10),10);
var date1 = new Date(parseInt(yr1), parseInt(mon1)-1, parseInt(dt1));
var date2 = new Date();
if(date2 < date1)
{
return false;
}
else
{
return true;
}
}, "Please enter valid date of birth");
:: baronne
------------------
"lekker, shot bru