Javascript: check apriopriate birth date
var checkBirthDate = function(month, year, minAge){
var currentDate = new Date();
return ((new Date(parseInt(year)+parseInt(minAge), month)).getTime() < (new Date(parseInt(currentDate.getFullYear()), parseInt(currentDate.getMonth())+1)).getTime()) ? true : false;
}
var checkBirthDate = function(month, year, minAge){
var currentDate = new Date();
var bDate = new Date(parseInt(year)+parseInt(minAge), month);
var cDate = new Date(parseInt(currentDate.getFullYear()), parseInt(currentDate.getMonth())+1);
if(bDate.getTime() < cDate.getTime()) {
return true; }
else {
return false; }
}
console.log(checkBirthDate(10, 1995, 18));