13 lines
416 B
JavaScript
13 lines
416 B
JavaScript
const numbReg = /^[0-9]+$/;
|
|
export const checkPhoneNumberInput = (num) => {
|
|
const numbReg = /^[0-9]+$/;
|
|
const newValue = num.replace("+63", "");
|
|
|
|
//Check if value is not number.
|
|
if(newValue.length > 0 && !numbReg.test(newValue)) return false;
|
|
|
|
//Check if valus starts with number 9
|
|
if(newValue.length > 0 && !newValue.startsWith("9")) return false;
|
|
|
|
return true;
|
|
} |