validatorjs / validator.js

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

isMobileNumber fail validating new MTN Zambian numbers #1219

Closed denisbarriere closed 4 years ago

denisbarriere commented 4 years ago

Hi there,

First, I wanted to thank you for providing this amazing library that makes a lot of developers life easier!

I built an express API that needs to validate international mobile numbers, including Zambian numbers. I am using the express-validator library which relies on validator.js under the hood. To ensure the phone numbers received by this API are valid, I am using the following piece of code:

body('mobileNumber')
    .isMobilePhone('any', { strictMode: true })

It works fine, but it does not accept recent Zambia numbers which start with 076 (e.g. +260761234567)

Could you please help or let me know if this is on the roadmap?

Thanks a lot!

wilfredmulenga commented 4 years ago

Thanks Denis, I am experiencing the same issue.

dani2819 commented 4 years ago

Yes, after seeing the current implementation, valid mobile numbers for Zambia are those that start with 95 or 96 or 97.

ezkemboi commented 4 years ago

@denisbarriere, I will check at the issue and will try to fix the same issue. Also, if there are some resources that show all valid Zambia numbers prefix, you can share.

Thanks.

meshack-mbuvi commented 4 years ago

I can take this issue

AubreyHewes commented 4 years ago

@ezkemboi @profnandaa so this has been fixed by a pr? which has been merged... so this issue can be closed? I don't get the codebase acceptance criteria... I actually don't care anymore, was only looking for adding another/new validation but this would maybe later.

profnandaa commented 4 years ago

Sure.

wilfredmulenga commented 4 years ago

thanks @meshack-mbuvi