Skip to content

Commit

Permalink
fix(isMobilePhone): update Hungarian locale (#1826)
Browse files Browse the repository at this point in the history
* Add internal country code option

* Add new area code options

* Add tests to hu mobile number validation
  • Loading branch information
danielTiringer authored and profnandaa committed Oct 31, 2021
1 parent 73ccaa8 commit fe73607
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const phones = {
'fr-MQ': /^(\+?596|0|00596)[67]\d{8}$/,
'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,
'hu-HU': /^(\+?36)(20|30|70)\d{7}$/,
'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/,
'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
'it-SM': /^((\+378)|(0549)|(\+390549)|(\+3780549))?6\d{5,9}$/,
Expand Down
13 changes: 13 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -6109,6 +6109,19 @@ describe('Validators', () => {
'064349089895623459',
],
},
{
locale: 'hu-HU',
valid: [
'06301234567',
'+36201234567',
'06701234567',
],
invalid: [
'1234',
'06211234567',
'+3620123456',
],
},
{
locale: 'mz-MZ',
valid: [
Expand Down

0 comments on commit fe73607

Please sign in to comment.