-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 mobile phone validation for pt-br #1671
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. thanks for your contrib!
Codecov Report
@@ Coverage Diff @@
## master #1671 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 101 101
Lines 1854 1854
=========================================
Hits 1854 1854
Continue to review full report at Codecov.
|
Hi @profnandaa, any idea when this PR will be merged and a new version will be released? |
@@ -5935,12 +5939,12 @@ describe('Validators', () => { | |||
'5501599623874', | |||
'+55012962308', | |||
'+55 015 1234-3214', | |||
'+55 11 91431-4567', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were these removed, did you introduce a regression? I can't see it from the code change...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @profnandaa. I've removed because the previous rule was blocking numbers starting with 1 after 9 and those are valid brazilian numbers, so I've replaced for invalid numbers starting with 0 after 9. In this PR from last year it was added, but they aren't invalid numbers.
Sorry this skipped my previous review; we should merge it next. See my 1 comment above. |
Hi @profnandaa, any updates? 😃 |
@@ -98,7 +98,7 @@ const phones = { | |||
'nl-NL': /^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/, | |||
'nn-NO': /^(\+?47)?[49]\d{7}$/, | |||
'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/, | |||
'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[2-9]{1}\d{3}\-?\d{4}))$/, | |||
'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[1-9]{1}\d{3}\-?\d{4}))$/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be heavy redoxable, it was also before this PR, however.
Based on this previous PR #1407:
Changed RegExp for pt-br phone number validation, now supporting new numbers that start with 9 and are followed by 1 that isn't common, but it's possible as you can see on Google's libphonenumber validation.