LouisMazel/vue-phone-number-input

(BUG) status of isValid is turning into TRUE even if it's not correct

abernados opened this issue · 3 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

  1. Go to https://louismazel.github.io/vue-phone-number-input/
  2. Test the basic usage
  3. Select PH/Philippines as a country
  4. 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:
image

Screenshots

I entered 6 random numbers:
image

I entered 8 random numbers:
image

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
image

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.