Skip to content

Commit

Permalink
feat(isMobilePhone): change the german prefix from '+490' to '+49' or…
Browse files Browse the repository at this point in the history
… '0' (#1679)

* fix: restrict german numbers

* fix: allow 0 prefix

Co-authored-by: Anna-Maria Jansen <anna-maria.jansen@nui.care>
  • Loading branch information
AnnaMariaJansen and Anna-Maria Jansen authored Jul 16, 2021
1 parent 044159d commit 01eeaef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const phones = {
'ca-AD': /^(\+376)?[346]\d{5}$/,
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
'de-DE': /^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
'de-DE': /^((\+49|0)[1|3])([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7,9}$/,
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
Expand Down
24 changes: 12 additions & 12 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -5828,21 +5828,20 @@ describe('Validators', () => {
{
locale: 'de-DE',
valid: [
'+49015123456789',
'+4915123456789',
'+4930405044550',
'015123456789',
'15123456789',
'15623456789',
'15623456789',
'1601234567',
'16012345678',
'1621234567',
'1631234567',
'1701234567',
'17612345678',
'15345678910',
'15412345678',
'015123456789',
'015623456789',
'015623456789',
'01601234567',
'016012345678',
'01621234567',
'01631234567',
'01701234567',
'017612345678',
'015345678910',
'015412345678',
],
invalid: [
'34412345678',
Expand All @@ -5852,6 +5851,7 @@ describe('Validators', () => {
'16412345678',
'17012345678',
'+4912345678910',
'+49015123456789',
],
},
{
Expand Down

0 comments on commit 01eeaef

Please sign in to comment.