-
-
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
Incorrect validation for Maldives phone numbers #2101
Comments
It's not obvious from your sandbox which of your examples are supposed to be valid or not. Could you make a list of things that should be valid according to the numbering standard, and another list that should be invalid? Then you can print the results and we can see what discrepancies exist. Also, remember that |
You should probably also specify the locale in the |
According to documentation locale defaults to 'any' if not passed, and it works for other countries I've tested. |
My point is that if you want to test the behaviour of the maldives phone number validator, you should specify that locale. |
I am not familiar with the mobile phone numbers in the Maledives (yet), but I can see that the RegExp and your examples currently will never match: Currently the RegExp for dv-MV is: /^(+?960)?(7[2-9]|91|9[3-9])\d{7}$/ The RegExp tries to match basically three things
Even if I remove the spaces and hyphens between the numbers in your example, they still fall short on the other requirements
so the question is: are these valid phone numbers? So doing some quick research here, it might actually be that the RegExp might contain an issue, see the first two lines of the document here: I will do some more research this evening and revert back to you |
Yeah looks like the RegExp is wrong and was already wrong ever since it was added in October 2021: Checking previous numbering plans, seems to confirm this: ALso checking some "real world" examples, they all use a total of 7 digits, not 2 + 7 digits, as the RegExp currently suggests. Examples I will create a PR for this tomorrow morning at the latest to get this fixed |
The RegExp and corresponding tests were testing a wrong format. Correct format can be found in the numbering plan: https://web.archive.org/web/20220614004138/https://cam.gov.mv/docs/Numbering_plan.pdf fixes issue validatorjs#2101
associated with issue validatorjs#2101
The RegExp and corresponding tests were testing a wrong format. Correct format can be found in the numbering plan: https://web.archive.org/web/20220614004138/https://cam.gov.mv/docs/Numbering_plan.pdf fixes issue validatorjs#2101
associated with issue validatorjs#2101
… (#2109) * fix(isMobilePhone): fix invalid RegExp for dv-MV The RegExp and corresponding tests were testing a wrong format. Correct format can be found in the numbering plan: https://web.archive.org/web/20220614004138/https://cam.gov.mv/docs/Numbering_plan.pdf fixes issue #2101 * test(isMobilePhone): fix tests for dv-MV RegExp associated with issue #2101
Describe the bug
Valid Maldives phone numbers with country codes are not accepted as valid
Examples
https://codesandbox.io/s/validator-phone-number-validation-52j2tb?file=/src/App.js
https://en.wikipedia.org/wiki/Telephone_numbers_in_Maldives
The text was updated successfully, but these errors were encountered: