Skip to content
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

Locale Validation not correct? #821

Open
iandevlin opened this issue Jan 13, 2023 · 2 comments
Open

Locale Validation not correct? #821

iandevlin opened this issue Jan 13, 2023 · 2 comments

Comments

@iandevlin
Copy link

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 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?"

@abhisekp
Copy link
Owner

abhisekp commented Mar 26, 2023

The phone number is supposed to be valid for the specified country.

@iandevlin
Copy link
Author

Thanks for the reply, although that doesn't answer my question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants