I guess this is more of a question than an issue, although the answer will indicate whether it's a bug or not.
My understanding would be if you tried to validate a number with a specific locale using a different country code, that it would return false.
e.g. given
const phoneSchemaDE = yup.string().phone('DE');
I would expect the following to return false, as the country code is not DE:
phoneSchemaDE.isValidSync('+919876543210');
but it doesn't, it returns true.
So my ultimate quesiton is,
is the locale check:
"is this number a valid phone number when calling FROM this country?"
or
"is this number a valid number FOR this country?"
First of all thanks for creating this!
I guess this is more of a question than an issue, although the answer will indicate whether it's a bug or not.
My understanding would be if you tried to validate a number with a specific locale using a different country code, that it would return
false
.e.g. given
const phoneSchemaDE = yup.string().phone('DE');
I would expect the following to return
false
, as the country code is notDE
:phoneSchemaDE.isValidSync('+919876543210');
but it doesn't, it returnstrue
.So my ultimate quesiton is, is the locale check: "is this number a valid phone number when calling FROM this country?" or "is this number a valid number FOR this country?"