catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
https://catamphetamine.gitlab.io/libphonenumber-js/
MIT License
2.76k stars 218 forks source link

Isvalid() and isValidphonenumber not properly validating Russian phonenumbers #427

Closed sri-vasitum closed 2 years ago

sri-vasitum commented 2 years ago

Both of these functions are giving me true boolean value for 10 digit numbers which is not correct. For example it is giving me true value for this 8 (800) 555-3-35 which is incorrect. Also checked this with google-libphonenumber which gives false for this phonenumber.

import { isValidPhoneNumber ,parsePhoneNumber} from 'libphonenumber-js' import phoneUtil from 'google-libphonenumber' const ph = phoneUtil.PhoneNumberUtil.getInstance();

num = '8 (800) 555-3-35', country = 'RU'

const a = parsePhoneNumber(num,country) , b = ph.parseAndKeepRawInput(num,country)

console.log(a.isValid(), isValidPhoneNumber(num,country),ph.isValidNumber(b)) // true true false

catamphetamine commented 2 years ago

See "Bug reporting" section in the readme.