validatorjs / validator.js

String validation
MIT License
23.12k stars 2.31k forks source link

Not suport phone numbers ( Netherland example) #2435

Closed KaskoYurii closed 3 months ago

KaskoYurii commented 3 months ago

Hi! in that file https://github.com/validatorjs/validator.js/blob/master/src/lib/isMobilePhone.js, the RegEx: 'nl-NL': /^(((+|00)?31(0))|((+|00)?31)|0)6{1}\d{8}$/, NOT SUPPORTS numbers like +3197010281368 or which starts with +310854 but both variants are valid for the NL.

Same flow for the Romania: +40377880108

Parameter passed as isMobilePhone(phone, 'any')

WikiRik commented 3 months ago

+3197... is used for data applications, not mobile phone numbers. See https://www.acm.nl/en/publications/information-about-dutch-097-numbers-non-dutch-providers

+3185... is used for things like VoIP but I don't believe they fall under the scope for isMobilePhone.

Do note that we do not try to validate all phone numbers, but only mobile phone numbers.

KaskoYurii commented 3 months ago

Oh, thx. But perhaps it's better to add some validation for phones because now I need to mix the validation from lib for other fields and write my validation for phone format.

Thx, for the answer. Good luck!