validatePhoneNumberLength does not return TOO_LONG for invalid Ukrainian phone number
davidarny opened this issue · comments
A valid Ukrainian phone number includes 9 digits after +380
country code. I'm validating phone number with libphonenumber-js
and getting invalid results when user types 10 digits. Question is why user is able to type 10 digits?
I didn't found any info that Ukrainian phone number can be 10 symbols long (after a country code)
validatePhoneNumberLength("+380 93 111-111") // returns TOO_SHORT - it's ok
validatePhoneNumberLength("+380 93 111-1111") // returns undefined - it's ok
validatePhoneNumberLength("+380 93 111-11111") // returns undefined - it's not ok, should be TOO_LONG
validatePhoneNumberLength("+380 93 111-111111") // returns TOO_LONG - it's ok
Question is why user is able to type 10 digits?
This library doesn't provide any "typing" capabilities
@catamphetamine yeah, I'm using a masking library which relies on validatePhoneNumberLength
function to prevent typing too long phone numbers. Sorry for confusion :)
So what's your question then?
validatePhoneNumberLength
should return TOO_LONG
for such phone number I suppose: +380 93 111-11111
. Valid Ukrainian phone number has only 9 digits after +380
@DavidArutiunian See the "bug reporting" section of the readme. There it explains how to check any assumptions using Google's demo.
@catamphetamine here they're
- This one is valid: https://libphonenumber.appspot.com/phonenumberparser?number=%2B380931111111
- This one is not: https://libphonenumber.appspot.com/phonenumberparser?number=%2B3809311111111
And from your demo:
- Valid - https://catamphetamine.gitlab.io/libphonenumber-js/?parseCountry=UA&parseValue=380931111111&asYouTypeCountry=US&findNumbersCountry=US&findNumbersText=For%20more%20details%20call%20+7%20(800)%20555-35-35%20internationally%20or%20reach%20the%20local%20US%20branch%20at%20(213)%20373-4253%20ext.%201234%20for%20paid%20customer%20support.
- Invalid: https://catamphetamine.gitlab.io/libphonenumber-js/?parseCountry=UA&parseValue=3809311111111&asYouTypeCountry=US&findNumbersCountry=US&findNumbersText=For%20more%20details%20call%20+7%20(800)%20555-35-35%20internationally%20or%20reach%20the%20local%20US%20branch%20at%20(213)%20373-4253%20ext.%201234%20for%20paid%20customer%20support.
@DavidArutiunian According to the links you've posted, Google doesn't return TOO_LONG
for those numbers so libphonenumber-js
behavior is correct.
@DavidArutiunian And when it's too long then it returns TOO_LONG
:
https://libphonenumber.appspot.com/phonenumberparser?number=%2B38093111111111
Ok, I see. Thanks for clarification! Closing this issue.