首页 > TAG信息列表 > birthdays

处理身份证获取用户的年龄

                 testAge(idcard ) {           let birthday;       let nowDay = new Date();       // birthday = idcard.substr(6,4)       let birthdayYaer = idcard.substr(6, 4);       let birthdayMonth = idcard.substr(10, 2);    

根据出生日期算出年龄

根据出生日期换算年龄 getDate() { // this.value = 2001-05-17 出生日期 var birthdays = new Date(this.value.replace(/-/g, "/")); console.log(‘生日转换时间’,birthdays); let d = new Date(); this.age = d.getFullYear() - birthdays.g