validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

Mobile Phone validations - For The First Time Contributors

Open ezkemboi opened this issue 3 years ago • 98 comments

I would like to give this to the people who are new and would like to start contributing to validator.js.

The current version in isMobilePhone validation, we have less than 195 phone validations i.e

In the code https://github.com/validatorjs/validator.js/blob/master/src/lib/isMobilePhone.js, the validations exist from line 5 to line 119, which means we have probably 119 - 5 countries phone validations. Where might be other countries? That is up to someone who would like to choose which country does not exist and create a new validation for the same.

When making this change, apart from the file above, also add tests and update the isMobilePhone section in the README.

Also, please check on existing PR's if the country you choose to validate mobile phone numbers does not have an already PR raised.

All Prs are welcomed and we will do a review on the same

ezkemboi avatar Oct 08 '21 04:10 ezkemboi

Great catch, please do add @mairagee524 and reference your PR to this issue with the correct title such as phone number for Mexico(code) etc.

Thanks and looking forward to your PR. I will also double-check on the same.

ezkemboi avatar Oct 08 '21 06:10 ezkemboi

It seems that Cuba is not on the list either, could I work on that ?

pasagedev avatar Oct 08 '21 17:10 pasagedev

Sure, please do.

On Fri, Oct 8, 2021, 8:14 PM Pablo Salas Gelich @.***> wrote:

It seems that Cuba is not on the list either, could I work on that ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-938892563, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH756XKT3WGXB4RZAELUF4RHDANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ezkemboi avatar Oct 08 '21 17:10 ezkemboi

Afghanistan is also missing, working on that...

neel-desh avatar Oct 09 '21 12:10 neel-desh

Please do add and raise a Pr

On Sat, Oct 9, 2021, 3:15 PM Neel Deshmukh @.***> wrote:

Afghanistan is also missing, I belive

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-939287602, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH3HH5S7MKWFE26FRYLUGAW57ANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ezkemboi avatar Oct 09 '21 12:10 ezkemboi

Please do add and raise a Pr On Sat, Oct 9, 2021, 3:15 PM Neel Deshmukh @.***> wrote: Afghanistan is also missing, I belive — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#1761 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH3HH5S7MKWFE26FRYLUGAW57ANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Yes, I did.

Btw, for new contributors, what i did was find list of the country code and their ISO codes, wrote simple program to filter non existing countries and wrote the code.

here are the resources : https://www.att.com/support_media/images/pdf/Country_Code_List.pdf https://countrycode.org/

@ezkemboi I'm not adding all the missing country code validations, i would like other people to contribute, but after October if still there are no contributions in this or we have missing validations, I would try to complete the list...

neel-desh avatar Oct 09 '21 12:10 neel-desh

Sure thing.

On Sat, Oct 9, 2021, 3:49 PM Neel Deshmukh @.***> wrote:

Please do add and raise a Pr … <#m_7010722731381047102_> On Sat, Oct 9, 2021, 3:15 PM Neel Deshmukh @.***> wrote: Afghanistan is also missing, I belive — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#1761 (comment) https://github.com/validatorjs/validator.js/issues/1761#issuecomment-939287602>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH3HH5S7MKWFE26FRYLUGAW57ANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

Yes, I did.

Btw, for new contributors, what i did was find list of the country code and their ISO codes, wrote simple program to filter non existing countries and wrote the code.

here are the resources : https://www.att.com/support_media/images/pdf/Country_Code_List.pdf https://countrycode.org/

@ezkemboi https://github.com/ezkemboi I'm not adding all the missing codes as, i would like other people to contribute, but after October if still there are no contributions, I would try to complete the list...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-939291996, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH46IX2ZGVOLK4A7SZTUGA25RANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ezkemboi avatar Oct 09 '21 12:10 ezkemboi

I didn't see Botswana on the list. Could I add this validation?

mgndolan avatar Oct 10 '21 03:10 mgndolan

@mgndolan please add that and raise a PR, I will review that.

ezkemboi avatar Oct 10 '21 06:10 ezkemboi

It seems like Madagascar in not on the list. Could I add this validation?

rootkit7628 avatar Oct 10 '21 07:10 rootkit7628

looks like grenada is also not there in the list, should i add this a validation for this?

Sidd2024 avatar Oct 10 '21 08:10 Sidd2024

Please do add them.

On Sun, Oct 10, 2021, 11:20 AM Siddhant Sharma @.***> wrote:

looks like grenada is also not there in the list, should i add this a validation for this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-939429396, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH3S2B3UKSG6BKHYNQ3UGFEGFANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ezkemboi avatar Oct 10 '21 08:10 ezkemboi

It seems like Bhutan is not on the list, should I add validation for this? @ezkemboi

lakshayr003 avatar Oct 10 '21 15:10 lakshayr003

Yes @lakshayr003

ezkemboi avatar Oct 10 '21 15:10 ezkemboi

It would we nice if we could write comment country name in front of each country code.

HackProAIT avatar Oct 10 '21 18:10 HackProAIT

I was just poking around and noticed that there wasn't an entry for Cameroon. Should I work on this?

tarob0ba avatar Oct 10 '21 22:10 tarob0ba

Opened PR #1772.

tarob0ba avatar Oct 11 '21 02:10 tarob0ba

Good stuff @beckettnormington. Thanks all for opening PRs, let's keep them coming. I will spend this week reviewing them.

ezkemboi avatar Oct 11 '21 02:10 ezkemboi

@ezkemboi Hi! I previously did a contribution to this project, by adding mobile phone number validation for Sri Lanka. I was inspired to participate in Hacktoberfest this time and reached out again.

Just noticed that the contribution I added to validate mobile numbers in Sri Lanka has been replaced by this: en-SL': /^(\+?232|0)\d{8}$/

However, it does not validate mobile numbers in Sri Lanka correctly (sources: https://en.wikipedia.org/wiki/Telephone_numbers_in_Sri_Lanka).

Is there a specific reason for the change? If not, I can make the necessary changes to make it work correctly again. Thank you!

Madhavi96 avatar Oct 11 '21 03:10 Madhavi96

Please do make the changes @Madhavi96 . But, also, I will need to make sure why it was changed and if the changes made are also necessary. Thank you.

ezkemboi avatar Oct 11 '21 03:10 ezkemboi

Thanks. Let me know if you find anything on the requirement for the change. Until then I'll do the changes and raise a PR.

Madhavi96 avatar Oct 11 '21 03:10 Madhavi96

@ezkemboi Found the validation for Sri Lanka, under 'si-LK': /^(?:0|94|\+94)?(7(0|1|2|5|6|7|8)( |-)?\d)\d{6}$/, and that is correct

Apologies for the false alarm!

Madhavi96 avatar Oct 11 '21 16:10 Madhavi96

No worries

On Mon, Oct 11, 2021, 7:30 PM Ishara Madhavi @.***> wrote:

@ezkemboi https://github.com/ezkemboi Found the validation for Sri Lanka, under 'si-LK': /^(?:0|94|+94)?(7(0|1|2|5|6|7|8)( |-)?\d)\d{6}$/, and that is correct

Apologies for the false alarm!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-940178995, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH5QRBHWNFGD4W3X6YLUGMGKLANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ezkemboi avatar Oct 11 '21 17:10 ezkemboi

@ezkemboi I created a pull request but the npm test failed even though it runs successfully on my local machine, Im using node v14.18.0 and npm v6.14.15

PR:- added brunei (ms-BN)

Error- Unexpected token ) Referenced from: /home/runner/work/validator.js/validator.js/node_modules/eslint-config-airbnb-base/index.js Referenced from: /home/runner/work/validator.js/validator.js/.eslintrc.json /home/runner/work/validator.js/validator.js/node_modules/eslint-module-utils/parse.js:97 ); ^ npm ERR! Failed at the [email protected] lint script 'eslint src test'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the validator package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! eslint src test

Issue happens for test on Nodejs 6

PR code - #1776

rohitnairtech avatar Oct 12 '21 06:10 rohitnairtech

Hi @ezkemboi , I have submitted the PR #1770, I am a first time contributor so it would be great if you could check if I have followed all the steps correctly?

lakshayr003 avatar Oct 12 '21 11:10 lakshayr003

It seems Croatia isn't on the list. could i work on that?

atom19-i avatar Oct 12 '21 15:10 atom19-i

Good stuff

ezkemboi avatar Oct 13 '21 12:10 ezkemboi

Hi, I have done an enhancement to the mobile number validation regex used for Sri Lanka and submitted the PR.

Madhavi96 avatar Oct 13 '21 13:10 Madhavi96

some business customer in Estonia may want to use +3726xxxxx for their phone nr, but validation does`t allows us to use it

'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,

PS, im not from Estonia, got this information from my client

borm avatar Oct 14 '21 13:10 borm

@borm thank you for your feedback ! Feel free to open a separate issue if you think it's a bug or if you can/want a new PR if you think you can fix it

tux-tn avatar Oct 14 '21 13:10 tux-tn

It doesn't look like Haiti is on this list - I can add it?

letsaguiar avatar Oct 15 '21 16:10 letsaguiar

El Salvador is not in the list. I will add it :D

crisjumbo avatar Oct 17 '21 19:10 crisjumbo

El Salvador is not in the list. I will add it :D

Someone already opened a PR for Salvador

tux-tn avatar Oct 17 '21 20:10 tux-tn

Looks like Argentina is not on the list. Can I add it?

Pranai2518 avatar Oct 18 '21 03:10 Pranai2518

Looks like Argentina is not on the list. Can I add it?

Argentina is on the list

pasagedev avatar Oct 18 '21 05:10 pasagedev

Looks like Morocco is not on the list. Can I add it?

sumitkumarju avatar Oct 18 '21 06:10 sumitkumarju

Hi, I did see India was not on the list. Added regex successfully. All tests passed #1805

siddharth-sable avatar Oct 19 '21 09:10 siddharth-sable

Looks like Croatia is not on the list. Can I add it?

zolezzi avatar Oct 19 '21 14:10 zolezzi

Looks like America Samoa is not there. Can i fix it?

Tharunkumar1411 avatar Oct 19 '21 14:10 Tharunkumar1411

@zolezzi I have already submitted PR for croatia #1779.

atom19-i avatar Oct 19 '21 15:10 atom19-i

@atom19-i Thanks! I did not see your comment, sorry! Looking at the comments and validations, Qatar is not in the list, can I add it?

zolezzi avatar Oct 19 '21 19:10 zolezzi

@atom19-i Thanks! I did not see your comment, sorry! Looking at the comments and validations, Qatar is not in the list, can I add it?

You can add any locale as long as it doesn't already exist and there is no open PR for it or someone that requested to add it before you!

tux-tn avatar Oct 19 '21 20:10 tux-tn

I don't see Maldives in the list currently. I'll pick that up.

Prajwalrajbasnet avatar Oct 20 '21 07:10 Prajwalrajbasnet

@ezkemboi I have updated Bangladesh and added Myanmar mobile number validation. Can you please approve.

ferdousulhaque avatar Oct 22 '21 15:10 ferdousulhaque

Added Jamaica validation in #1819

c-tanner avatar Oct 22 '21 17:10 c-tanner

Added Kiribati validation in #1820

c-tanner avatar Oct 22 '21 17:10 c-tanner

Namibia validation needed?

ZeeMangena avatar Oct 23 '21 18:10 ZeeMangena

There's already a regex for the Hungarian mobile numbers, but it is incomplete. It is missing the internal country code option (06 instead of +36), and there are also new area codes added in the past few years that are not included. It would also be nice if it was covered with a few test cases. Should this be an issue on its own, or could I raise a PR against this one and get it updated?

danielTiringer avatar Oct 24 '21 16:10 danielTiringer

There's already a regex for the Hungarian mobile numbers, but it is incomplete. It is missing the internal country code option (06 instead of +36), and there are also new area codes added in the past few years that are not included. It would also be nice if it was covered with a few test cases. Should this be an issue on its own, or could I raise a PR against this one and get it updated?

Feel free to open a new PR. No need to create a new issue!

tux-tn avatar Oct 24 '21 16:10 tux-tn

Many thanks to all the people that participated as part of Hacktoberfest. We had 28 Pull requests merged 🎉 !

tux-tn avatar Nov 01 '21 20:11 tux-tn

Hello, I would like to add Burundi validation.

pavolmarc avatar Nov 10 '21 11:11 pavolmarc

Hello, I would like to add Burundi validation.

Thank you @pavolmarc ! You can go ahead and open a PR

tux-tn avatar Nov 10 '21 12:11 tux-tn

Hi, I'm a student in 4th year looking to start working on open-source projects, can I contribute by working on this issue, if there is any phone number that would need to be added ?

LucasFab avatar Nov 10 '21 18:11 LucasFab

@LucasFab Welcome ! Feel free to choose any locale that doesn't already exist (you check the existing list in the readme file) or that don't have any open PR

tux-tn avatar Nov 12 '21 22:11 tux-tn

@tux-tn Hello I opened a pull request ready to review - #1872

pavolmarc avatar Nov 17 '21 11:11 pavolmarc

@tux-tn Hello, I have added one country in the list, please review #1880. Thanks.

kuldp18 avatar Dec 04 '21 04:12 kuldp18

@tux-tn Hello, I have added Iceland phone validation.(#1885)

sarazm2000 avatar Dec 17 '21 06:12 sarazm2000

hello, i would like to add validation for Lesotho!

DevilsAutumn avatar Jan 19 '22 08:01 DevilsAutumn

hello, i don't see the validation for Trinidad and Tobago. May i add it?

YTeyddie22 avatar Jan 19 '22 17:01 YTeyddie22

Please add in separate PRs I case.

On Wed, Jan 19, 2022, 8:24 PM Teddy Yongo @.***> wrote:

hello, i don't see the validation for Trinidad and Tobago. May i add it?

— Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-1016693760, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPHYVBP6GC5NI7PVBSCDUW3XTHANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

ezkemboi avatar Jan 19 '22 17:01 ezkemboi

PR for adding Nicaragua https://github.com/validatorjs/validator.js/pull/1909

ajGingrich avatar Jan 20 '22 14:01 ajGingrich

Hello, I still don't see validations for multiple countries. Can I work on it and add all of those ????

Mustafiz04 avatar Jan 23 '22 06:01 Mustafiz04

Yes please @Mustafiz04

ezkemboi avatar Jan 23 '22 06:01 ezkemboi

Hello, I've found a couple more that can be added to the list - am I okay to work on those?

savannahvaith avatar Mar 15 '22 12:03 savannahvaith

@savannahvaith go for it!

WikiRik avatar Mar 15 '22 12:03 WikiRik

MONGOLIA is missing I am working on it

rksp25 avatar Jun 10 '22 19:06 rksp25

Hello saw Aruba was not on the list. Shared the PR.

adida948 avatar Jun 13 '22 15:06 adida948

Hi I fix MONGOLIA missing from list fixed issue please find PR: https://github.com/validatorjs/validator.js/pull/1993

rksp25 avatar Jun 29 '22 19:06 rksp25

I am working on country Benin

rksp25 avatar Jul 04 '22 04:07 rksp25

Hi I fix BENIN missing from list fixed issue Please review PR: https://github.com/validatorjs/validator.js/pull/1997/

rksp25 avatar Jul 05 '22 13:07 rksp25

@profnandaa , others Please review PR: https://github.com/validatorjs/validator.js/pull/1997

rksp25 avatar Jul 06 '22 12:07 rksp25

added mobile phone validation for Papua New Guinea. PR: #2002

kai2128 avatar Jul 17 '22 19:07 kai2128