Commit 9dddf37f authored by 郝聪敏's avatar 郝聪敏

Merge branch 'feature/fix_date' into 'master'

fix: 校验日期合法性

See merge request !239
parents cf80ed71 f9769235
......@@ -242,6 +242,11 @@ export function getBirthDate(idCard) {
birthday = birthday.replace(/(.{4})(.{2})/, "$1-$2-");
}
if (birthday && !isValidDate(new Date(birthday))) {
birthday = "";
}
return birthday;
}
......@@ -307,3 +312,8 @@ export function onKeyboardStateChange(callback = () => {}, off = false) {
}
}
}
// 校验是否合法日期
export function isValidDate(date) {
return date instanceof Date && !isNaN(date.getTime());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment