-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for DR Congo mobile phone validation (fr-CD) #2041
Conversation
- fixes validatorjs#2040 [delivers]
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #2041 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 104 104
Lines 2308 2308
Branches 578 578
=========================================
Hits 2308 2308
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Hey @rubiin, can anyone please review this PR? |
Hey @profnandaa, your review on this PR will be highly appreciated. 😊 |
@@ -94,6 +94,7 @@ const phones = { | |||
'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/, | |||
'fr-BF': /^(\+226|0)[67]\d{7}$/, | |||
'fr-BJ': /^(\+229)\d{8}$/, | |||
'fr-CD': /^(\+?243|0)?(8|9)\d{8}$/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I check the ITU numbering plan (page 1), it looks like the regexp here would be too permissive.
Kindly check the ranges that were officially announced in that document and adjust your regexp accordingly please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @pano9000, nice catch! thx for the feedback.
You should also note that: the above document is very old 😂(from 2009). Some MNOs in this list are no longer operational. And there are even new operators with different numbering structure.
But I think I can come up with something like /^(\+?243|0)?(8|9)(0|1|2|4|7|8\9)\d{7}$/
, so telephones such as +243 902 XXXXXXX can pass the regex.
What do you think about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most recent document provided to ITU is from 2013; https://www.itu.int/oth/T0202000037/en
That document is less clear than those of some other countries but looking at the communication of 15.IX.2010 I would propose the RegExp to be the following; /^(\+?243|0)?(8[0-2|4|8|9]|9[7-9])\d{7}$/
.
+243 902 XXXXXXX
does not seem to be valid from the official source of the ITU, but if you can provide one from the national authorities that do show that this should be valid we can look at a different RegExp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most recent document provided to ITU is from 2013; https://www.itu.int/oth/T0202000037/en That document is less clear than those of some other countries but looking at the communication of 15.IX.2010 I would propose the RegExp to be the following;
/^(\+?243|0)?(8[0-2|4|8|9]|9[7-9])\d{7}$/
.+243 902 XXXXXXX
does not seem to be valid from the official source of the ITU, but if you can provide one from the national authorities that do show that this should be valid we can look at a different RegExp
Hey @WikiRik. My actual phone number is +243 902 575 693
from Africel 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
- fixes #2040 - clean-up #2041 Co-authored-by: coolbeatz71 <[email protected]>
combined in #2164 |
Checklist