|
@ -136,7 +136,7 @@ function format(date) { |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 身份证加密 |
|
|
* 身份证加密 |
|
|
*/ |
|
|
*/ |
|
|
function maskIDCard(idCard) { |
|
|
function maskIDCard(idCard) { |
|
|
// 判断身份证号是否有效
|
|
|
// 判断身份证号是否有效
|
|
|
if (idCard.length === 18) { |
|
|
if (idCard.length === 18) { |
|
@ -276,7 +276,8 @@ function calculateAge(idCard) { |
|
|
let age = now.getFullYear() - birth.getFullYear(); |
|
|
let age = now.getFullYear() - birth.getFullYear(); |
|
|
|
|
|
|
|
|
// 如果生日还没过,年龄减一
|
|
|
// 如果生日还没过,年龄减一
|
|
|
if (now.getMonth() < birth.getMonth() || (now.getMonth() === birth.getMonth() && now.getDate() < birth.getDate())) { |
|
|
if (now.getMonth() < birth.getMonth() || (now.getMonth() === birth.getMonth() && now.getDate() < birth |
|
|
|
|
|
.getDate())) { |
|
|
age--; |
|
|
age--; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|