You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

12 lines
259 B

export function getSex(idCard) {
let res = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/;
if (idCard && res.test(idCard)) {
let genderCode = idCard.charAt(16);
if (parseInt(genderCode) % 2 == 0) {
return 'F';
}
return 'M';
}
return '';
}