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

feat(isMobilePhone): change the german prefix from '+490' to '+49' or '0' #1679

Merged
merged 2 commits into from
Jul 16, 2021

Conversation

AnnaMariaJansen
Copy link
Contributor

This would fix #1670

As described mobile phone numbers in Germany start with a 0 prefix such as 0157xxxxxxx. However the preceding 0 is dropped if the country code prefix +49 is added. Therefore I restrict the regex to +49 or 0 and no +490.

I adjusted the tests and added a '0' as validation to '15123456789'.

Examples
invalid:
'15123456789'
valid:
'+4915123456789'
'015123456789'

Checklist

  • [ x] PR contains only changes related; no stray files, etc.
  • [ x] README updated (where applicable)
  • [ x] Tests written (where applicable)

@codecov
Copy link

codecov bot commented Jun 7, 2021

Codecov Report

Merging #1679 (39df426) into master (907bb07) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1679   +/-   ##
=========================================
  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 907bb07...39df426. Read the comment docs.

Copy link
Member

@tux-tn tux-tn left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your contribution @AnnaMariaJansen . The difference between your PR and #1675 is that numbers like 15623456789 are not valid anymore?

@Burnett01
Copy link

The problem with this PR is that it doesn't resolve the fundamentally wrong implementation of german mobile phone numbers. Local landline numbers (Berlin) are still valid. A more in-depth explanation can be found here:

#1670 (comment)

@AnnaMariaJansen
Copy link
Contributor Author

LGTM! Thank you for your contribution @AnnaMariaJansen . The difference between your PR and #1675 is that numbers like 15623456789 are not valid anymore?

We use the validator for our application and that was our main issue. Yes. These numbers should not be valid in any case.

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 the catch!

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

Successfully merging this pull request may close these issues.

False positives with German mobile phone numbers
5 participants