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

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

Open trd-db opened this issue 4 years ago • 3 comments

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

Checklist

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

trd-db avatar Jan 28 '22 20:01 trd-db

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.

codecov[bot] avatar Jan 28 '22 20:01 codecov[bot]

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

mik7up avatar Feb 18 '22 14:02 mik7up

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.

ghost avatar Feb 18 '22 15:02 ghost