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

How to validate country code is always on mobile phone? #741

Closed
henrikra opened this issue Oct 31, 2017 · 2 comments · Fixed by #769
Closed

How to validate country code is always on mobile phone? #741

henrikra opened this issue Oct 31, 2017 · 2 comments · Fixed by #769

Comments

@henrikra
Copy link

At the moment looks like the country codes are optional on isMobilePhone. How can I validate that the phone numbers I validate always have country code with them?

@chriso
Copy link
Collaborator

chriso commented Nov 14, 2017

That's not currently possible AFAIK. You might be able to check whether the string starts with a + symbol.

@henrikra
Copy link
Author

Yeah I have done it that way for now :P Feels like tho this should belong to this library since it is doing the validation :)

profnandaa added a commit to profnandaa/validator.js that referenced this issue Dec 25, 2017
This commit adds an option on isMobilePhone to allow for strict
strict checking of mobile phone numbers, i.e. must start with
'+<country-code>'

fixes validatorjs#741
profnandaa added a commit to profnandaa/validator.js that referenced this issue Dec 25, 2017
This commit adds an option on isMobilePhone to allow for strict
strict checking of mobile phone numbers, i.e. must start with
'+<country-code>'

fixes validatorjs#741
andela-anandaa pushed a commit to profnandaa/validator.js that referenced this issue Jan 30, 2018
This commit adds an option on isMobilePhone to allow for strict
strict checking of mobile phone numbers, i.e. must start with
'+<country-code>'

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

Successfully merging a pull request may close this issue.

2 participants