-
Notifications
You must be signed in to change notification settings - Fork 43
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
Invalid US number incorrectly identified as a Jamaica number #38
Comments
From what I understand, and it's often the desirable behavior, the provided country is just a fallback for phone numbers not in an international format. If a phone number is a valid international phone number, you often don't want to reject it. Say you have a customer traveling from Jamaica, they have a valid phone number, you can serve them even in US. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The library incorrectly identifies an invalid USA phone number as Jamaica number.
Example:
phonenumber.ParseWithLandLine("+1 289 2999", "US")
Expected output: "". Actual output: +12892999. I believe that since the length matched Jamaica's number length (7), it matched it with the country Jamaica.
The issue is that despite the country being provided correctly in the input, the function tries to identify the ISO3166 by Number in the following lines, and the GetISO3166ByNumber function matches with Jamaica. I did not follow why the library tried to retrieve ISO3166 by phone number when the correct country (US) was already provided as input.
The text was updated successfully, but these errors were encountered: