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

Facing issue in formatting number #71

Open
arslankaleem7229 opened this issue Jun 20, 2024 · 1 comment
Open

Facing issue in formatting number #71

arslankaleem7229 opened this issue Jun 20, 2024 · 1 comment

Comments

@arslankaleem7229
Copy link

I am retrieving contacts from my phone and parsing it using formatNumberSync function to format phone number now I am facing an issue with country codes. Let suppose some of my contacts have country code in it and some contacts don't have country code in it. How you handle this thing? As the number being parsed it plain String lie "1234567890" or "+11234567980". Now how can I handle this thing.

Thanks!

@acoutts
Copy link
Owner

acoutts commented Jun 20, 2024

It's a tricky thing. There's no real solution since you have to know the country code to correctly parse it. The best you can do is guess which is what the package tries to do.

A safe approach is to default to the device locale to get the country code, because you can reasonably assume local numbers to the device probably don't have the country code saved for most cases.

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