catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript

Home Page:https://catamphetamine.gitlab.io/libphonenumber-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Isvalid() and isValidphonenumber not properly validating Russian phonenumbers

sri-vasitum opened this issue · comments

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

See "Bug reporting" section in the readme.