Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vietnam Phone Number Validation Failed #284

Closed
shanafme opened this issue Dec 19, 2018 · 1 comment
Closed

Vietnam Phone Number Validation Failed #284

shanafme opened this issue Dec 19, 2018 · 1 comment

Comments

@shanafme
Copy link

shanafme commented Dec 19, 2018

This number:
+841664223299 (Vietnam)

Is failing Google's libphonenumber IsValid Check at https://libphonenumber.appspot.com/phonenumberparser?number=%2B841664223299.

But is passing the Valid check at libphonenumber-js:
image

@catamphetamine
Copy link
Owner

I updated the readme with a more detailed explanation of such case:

isValid()

Checks if the phone number is "valid". First checks the phone number length and then checks the phone number digits against all available regular expressions.

By default the library uses "minimal" metadata which is only 75 kilobytes in size but also doesn't include most of the validation regular expressions resulting in less strict validation rules (some very basic validation is still included for each country). If you don't mind the extra 65 kilobytes of metadata then use "full" metadata instead (140 kilobytes) (see Customizing metadata section of this document) for validating phone numbers. Google's library always uses "full" metadata so it will yield different isValidNumber() results compared to the "minimal" metadata used by default in this library.

See also "Using phone number validation feature" considerations.

getType()

Returns phone number type (fixed line, mobile, toll free, etc) or undefined (if the number is invalid or if there are no phone number type regular expressions for this country in metadata).

By default the library uses "minimal" metadata which is only 75 kilobytes in size but also doesn't include most of the regular expressions corresponding to each specific phone number type (fixed line, mobile, toll free, etc) resulting in getType() returning undefined in most cases. If you don't mind the extra 65 kilobytes of metadata then use "full" metadata instead (140 kilobytes) (see Customizing metadata section of this document) for getting phone number type. Google's library always uses "full" metadata so it will yield different getNumberType() results compared to the "minimal" metadata used by default in this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants