libphonenumber-js
libphonenumber-js copied to clipboard
isValidPhoneNumber and parsePhoneNumber validate the number incorrectly
If you call isValidPhoneNumber("+485555555")
, it returns that it is a valid Polish number.
If you call parsePhoneNumber("+485555555")
, then the result:
PhoneNumber {
country: 'PL',
countryCallingCode: '48',
nationalNumber: '5555555',
number: '+485555555',
metadata: {
version: 4,
....
}
}
Actually this is not true because 5555555 is not a Polish phone number. Exactly the same problem with the combination +481111111
- Google demo: https://libphonenumber.appspot.com/phonenumberparser?number=5555555&country=PL
- libphonenumber-js demo: https://catamphetamine.gitlab.io/libphonenumber-js/?parseCountry=PL&parseValue=5555555&asYouTypeCountry=US&findNumbersCountry=US&findNumbersText=For%20more%20details%20call%20%2B7%20(800)%20555-35-35%20internationally%20or%20reach%20the%20local%20US%20branch%20at%20(213)%20373-4253%20ext.%201234%20for%20paid%20customer%20support.
Version "libphonenumber-js": "^1.10.30",
What's the exact issue?
isValidPhoneNumber("+485555555")
returns true, but should return false.
isValidPhoneNumber("+485555555")
returns true, but should return false.
Provide an online demo illustrating the issue.
And that online demo should use the "max" metadata
Same problem with number +375854545 or +3758*****
https://github.com/catamphetamine/libphonenumber-js/assets/116653645/4cef5f16-54f2-4b94-8da6-66918324bee5
Polish numbers has 9 digits, not 7.