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

Non US phone numbers do not validate correctly #47

Open
igorT opened this issue Mar 28, 2017 · 4 comments
Open

Non US phone numbers do not validate correctly #47

igorT opened this issue Mar 28, 2017 · 4 comments

Comments

@igorT
Copy link

igorT commented Mar 28, 2017

Added a test at #46
Maybe for something as complex as phone number, we should delegate to an external/more robust library?

@offirgolan
Copy link
Collaborator

offirgolan commented Mar 29, 2017

@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. 😄

@urbany
Copy link

urbany commented May 5, 2017

This is the best lib I've found but is huge: https://github.com/googlei18n/libphonenumber/

@offirgolan
Copy link
Collaborator

@urbany yeah that repo is a bit overkill. I suggest creating your own validator with that API if that is what you need.

@MichalBryxi
Copy link

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.

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

4 participants