function stuCardIdCanApplyByAge(cardId){
var birthYear = cardId.substring(6,10);
var birthMonth = cardId.substring(10,12);
var birthDay = cardId.substring(12,14);
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth() +1;
var day = now.getDate();
var age = year - birthYear;
if(age>18){
return true;
}else{
if(age<18){
return false;
}else{
if(birthMonth>month){
return false;
}else if(birthMonth<month){
return true;
}else{
if(birthDay<=day){
return true;
}else{
return false;
}
}
}
}
}
根据身份证号 查询是否满18岁
最新推荐文章于 2023-10-25 21:02:02 发布