Skip to content

fix(isMobilePhone): Add mobile phone validation locale for Moldova #1918

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

Closed
wants to merge 1 commit into from
Closed

fix(isMobilePhone): Add mobile phone validation locale for Moldova #1918

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jan 28, 2022

fix(isMobilePhone): Add mobile phone validation locale for Moldova(ro-MD, ru-MD)
Closes #1915

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)

@codecov
Copy link

codecov bot commented Jan 28, 2022

Codecov Report

Merging #1918 (2811404) into master (f055c11) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1918   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          102       102           
  Lines         2072      2072           
  Branches       472       472           
=========================================
  Hits          2072      2072           
Impacted Files Coverage Δ
src/lib/isMobilePhone.js 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f055c11...2811404. Read the comment docs.

@ghost ghost changed the title fix(isMobilePhone): Add mobile phone validation locale for Moldova(ro… fix(isMobilePhone): Add mobile phone validation locale for Moldova Jan 28, 2022
Copy link

@mihoaka mihoaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine

Copy link
Member

@rubiin rubiin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@mik7up
Copy link
Contributor

mik7up commented Feb 18, 2022

Wrong. Regexp not correspond to mobile phone!

Test set

valid: [
'+373(22)56-03-50',
'+373(22)56-73-13',
'+373(22)51-70-29',
'+373(552)3-49-08',
'+373(22)55-50-07',
'+373(22)71-76-29',
'+373(22)34-11-54',
'+373(552)5-25-10',
'+37355242510',
'+373 123 4567',
'+373 552 34 11 56',
'+373-532-4-11-56',
'+373.532.3.27.56',
'+373/532/29/01/28',
],

The +373(22)56-03-50 is not mobile number
The +3736333044 is bad, no mobile number that start with +37363

@ghost
Copy link
Author

ghost commented Feb 18, 2022

I pulled all the valid phone numbers from this phone number generator site. From what I was able to tell from that, and various formats for Moldova numbers I found online it seemed correct. I just made the regex so that the number didn't require parenthesis to be valid.

Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution; see if you can address my comment below.

'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,
'ru-MD': /^(\+373)(\/|\s|\.|\-|\()?\d{2,3}(\/|\s|\.|\-|\))?\d{1,2}(\/|\s|\.|\-|)?\d{2}(\/|\s|\.|\-|\()?\d{2}$/,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd never noticed this a alias,
could we just do ..['ru-MD'] = ..['ro-MD']?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like you would have to have the ..['ru-MD'] = ..['ro-MD'] outside the definition of the validator (see here), which could be messy with it having to be assigned outside the dict.

@profnandaa profnandaa added 🧹 needs-update For PRs that need to be updated before landing mc-to-land Just merge-conflict standing between the PR and landing. labels Apr 22, 2022
@ghost ghost closed this by deleting the head repository Aug 22, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mc-to-land Just merge-conflict standing between the PR and landing. 🧹 needs-update For PRs that need to be updated before landing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I think it's time to add Moldova to your validator
5 participants