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 mobile phone validation for pt-br #1671

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nandoofz
Copy link

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.

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.

LGTM. thanks for your contrib!

@codecov
Copy link

codecov bot commented May 24, 2021

Codecov Report

Merging #1671 (4b10795) into master (d1a9b6d) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1671   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          101       101           
  Lines         1854      1854           
=========================================
  Hits          1854      1854           
Impacted Files Coverage Δ
src/lib/isMobilePhone.js 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1a9b6d...4b10795. Read the comment docs.

@profnandaa profnandaa added the ready-to-land For PRs that are reviewed and ready to be landed label May 24, 2021
@nandoofz
Copy link
Author

nandoofz commented Jun 7, 2021

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',
Copy link
Member

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

Copy link
Author

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.

@profnandaa
Copy link
Member

Sorry this skipped my previous review; we should merge it next. See my 1 comment above.

@profnandaa profnandaa added 🎉 first-pr 🧹 needs-update For PRs that need to be updated before landing and removed ready-to-land For PRs that are reviewed and ready to be landed labels Jul 16, 2021
@nandoofz
Copy link
Author

nandoofz commented Oct 5, 2021

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}))$/,
Copy link
Contributor

@fedeci fedeci Oct 5, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 first-pr 🧹 needs-update For PRs that need to be updated before landing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants