ngneat/falso

PhoneNumber not validated

jbdemonte opened this issue · 6 comments

Is this a regression?

No

Description

falso can generate number like this one : +33 0 54 43 46 83 when using the FR code country (due to the mask "+33 # ## ## ## ##")

Problem is this number is no validating the libphonenumber-js

import { isValidPhoneNumber } from "libphonenumber-js";

console.log(isValidPhoneNumber("+33 0 54 43 46 83", "FR")); => false
console.log(isValidPhoneNumber("+33 6 54 43 46 83", "FR")); => true

Would it be possible to know what is considered a valid number for each place?

Number in france

Numbers starts from 01 to 07 for normal numbers, 08 and 09 are for special numbers, there is no 00

So, in international number, there is no +33 0 prefixes, 1 to 9 would be correct I guess

https://codesandbox.io/s/phone-numbers-cmg7mv

Number in france

Numbers starts from 01 to 07 for normal numbers, 08 and 09 are for special numbers, there is no 00

So, in international number, there is no +33 0 prefixes, 1 to 9 would be correct I guess

https://codesandbox.io/s/phone-numbers-cmg7mv

I'm pretty sure that +33 is the international code for France. When I call French mobile numbers from the U.K. I replace the leading 0 with +33.

We could look into using Google's phone number lib as a dev dependency to validate number in our tests (we would still need to research number formats ourselves, but at least we'd know if they are valid)

Yes, but no double 0

+33 stand for initial 0

national format is : 0[1-9] ## ## ## ##
international format is : +33 [1-9] ## ## ## ##

@jbdemonte you're welcome to create a PR