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

Fixed Indonesian Phone number Regex #863

Merged
merged 8 commits into from
Jul 31, 2018
Merged

Conversation

idrisakmal
Copy link
Contributor

@idrisakmal idrisakmal commented Jul 17, 2018

Context

Indonesian phone number validator previously allows any digit after +62.
This breaks our validation process where user can enter +621 and the validation returns as true thus costing us to send sms to an invalid number ie: +621

Fix

Fixed the indonesian phone regex to only accept +62 8nn || 08nn, where 8nn denotes the mobile phone provider in Indonesia. Then another 8-12 numbers as the phone number.

Based on the test, there are numbers which starts from 0. But referring to https://wikitravel.org/en/Wikitravel:Phone_numbers#Indonesia all mobile numbers will only starts with 8nn. I fixed the regex anyway to match all the test cases.

Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add test cases for this in /test/validators.js?

@profnandaa
Copy link
Member

Good catch though! 🎉

@chriso
Copy link
Collaborator

chriso commented Jul 31, 2018

Thanks for the PR 😄

@chriso chriso merged commit c6d8afc into validatorjs:master Jul 31, 2018
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

Successfully merging this pull request may close these issues.

3 participants