getAge() {
let reg = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
if (reg.test(this.formData.IDCARD)) {
let agestr = this.formData.IDCARD.slice(6, 14);
agestr =
agestr.slice(0, 4) +
"-" +
agestr.slice(4, 6) +
"-" +
agestr.slice(6, 8);
this.formData.BIRTHDAY = agestr;
this.formData.AGE = Math.floor(
(new Date() - new Date(agestr)) / (3600 * 24 * 1000 * 365)
);
console.log('(new Date() - new Date(agestr)====', (new Date() - new Date(agestr)))
} else {
this.$message.error("请输入正确格式的身份证号");
}
},
09-22
4292