Skip to content

Commit ad25baa

Browse files
danielTiringertheteladras
authored andcommitted
fix(isMobilePhone): update Hungarian locale (validatorjs#1826)
* Add internal country code option * Add new area code options * Add tests to hu mobile number validation
1 parent 3eb3ba8 commit ad25baa

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/lib/isMobilePhone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const phones = {
8181
'fr-MQ': /^(\+?596|0|00596)[67]\d{8}$/,
8282
'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
8383
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,
84-
'hu-HU': /^(\+?36)(20|30|70)\d{7}$/,
84+
'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/,
8585
'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
8686
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
8787
'it-SM': /^((\+378)|(0549)|(\+390549)|(\+3780549))?6\d{5,9}$/,

test/validators.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6150,6 +6150,19 @@ describe('Validators', () => {
61506150
'064349089895623459',
61516151
],
61526152
},
6153+
{
6154+
locale: 'hu-HU',
6155+
valid: [
6156+
'06301234567',
6157+
'+36201234567',
6158+
'06701234567',
6159+
],
6160+
invalid: [
6161+
'1234',
6162+
'06211234567',
6163+
'+3620123456',
6164+
],
6165+
},
61536166
{
61546167
locale: 'mz-MZ',
61556168
valid: [

0 commit comments

Comments
 (0)