(BUG) status of isValid is turning into TRUE even if it's not correct
abernados opened this issue · comments
Describe the bug
When you select the Philippines and input a number, the status of isValid is turning into TRUE even if it's not correct. Sometimes isValid became TRUE if you entered 6 and 8 digits.
Steps to reproduce
- Go to https://louismazel.github.io/vue-phone-number-input/
- Test the basic usage
- Select PH/Philippines as a country
- Input 6 random numbers and isValid will become TRUE. Also when you input 8 random numbers, isValid will become TRUE.
Expected behavior
When you enter a number which is not the same format as the placeholder/hint above, it will not return the param, isValid, TRUE.
This is the correct format of the phone number:
Screenshots
Hi, I search on this for a while, and find the issuse is actually caused by the dependency lib: "libphonenumber-js"
It use the "parsePhoneNumberFromString" mehtod to get the parsing result and it's isValid() method is incorrect.
https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/19
Has anyone found a solution to this problem?
Try importing libphonenumber-js/max instead of libphonenumber-js, as that includes the minimum version which does not check some valid cases.