-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Non US phone numbers do not validate correctly #47
Comments
@igorT this has been discussed and contemplated a lot about a year ago and we decided that we will not support international phone numbers. There are too many factors to take into consideration so the best solution is to provide a custom regex for the country you are planning to support. EDIT: If you know of a clean and minimal solution to this problem, I would not mind exploring it. 😄 |
This is the best lib I've found but is huge: https://github.com/googlei18n/libphonenumber/ |
@urbany yeah that repo is a bit overkill. I suggest creating your own validator with that API if that is what you need. |
Personally happy to have to provide regex for my own country, not a big deal. But it would be nice to not call the validator type "phone", but "us-phone" or something alike. Went to the source code, visualized the regex, tried to see why it's not matching my phone and finally found this issue. Having the type named "US phone" would give me a hint, that it is not really a bug, but an intentional decision. |
Added a test at #46
Maybe for something as complex as phone number, we should delegate to an external/more robust library?
The text was updated successfully, but these errors were encountered: