/*
JS itself does not have the trim () function to cancel the blank characters in the string
Custom function: replace blank characters with regular expressions
*/
Function trim (s) {return S. Replace (/^ \ s + | \ s + $/g ,"");};
// Verify the ID card number and obtain the Date of birth
Function getbirthdatbyidno (iidno ){
VaR tmpstr = "";
VaR iddate = "";
VaR tmpint = 0;
VaR strreturn = "";
Iidno = trim (iidno );
If (iidno. length! = 15) & (iidno. length! = 18 )){
Strreturn = "the number of digits of the entered ID card number is incorrect ";
Return strreturn;
}
If (iidno. Length = 15 ){
Tmpstr = iidno. substring (6, 12 );
Tmpstr = "19" + tmpstr;
Tmpstr = tmpstr. substring (0, 4) + "-" + tmpstr. substring (4, 6) + "-" + tmpstr. substring (6)
Return tmpstr;
}
Else {
Tmpstr = iidno. substring (6, 14 );
Tmpstr = tmpstr. substring (0, 4) + "-" + tmpstr. substring (4, 6) + "-" + tmpstr. substring (6)
Return tmpstr;
}
}