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

Invalid phone number when it should be valid #67

Closed
onlineautoparts opened this issue Apr 17, 2017 · 5 comments
Closed

Invalid phone number when it should be valid #67

onlineautoparts opened this issue Apr 17, 2017 · 5 comments

Comments

@onlineautoparts
Copy link

onlineautoparts commented Apr 17, 2017

Hello,

I was running tests with australian numbers when I found that "413071810" is not valid if there's no "0" before it i.e. "0413071810"

I verified that Google's Javascript demo does recognize "413071810" as a valid number for Australia(AU) https://rawgit.com/googlei18n/libphonenumber/master/javascript/i18n/phonenumbers/demo-compiled.html

In Australia is normal to use "04" or "4" for mobile numbers. Also Safari autofill feature adds Australian mobile numbers without the zero that's how I found this problem.

@catamphetamine
Copy link
Owner

I had a look at your case and Google's demo indeed says that this is a valid number.
I personally think Google's algorythm is wrong and if 0 is really not required then you may create an issue in their repo to add nationalPrefixOptionalWhenFormatting="true" either to the format itself to to the whole AU country.
https://github.com/googlei18n/libphonenumber/blob/3894ee185c277ee5d0c9e81993030aaaff4a8d50/resources/PhoneNumberMetadata.xml#L1725-L1732

@onlineautoparts
Copy link
Author

Thank you for having a look at this. I believe the issue stills falls under this repository because even in their metadata they show "412345678" as an example for a mobile number.

https://github.com/googlei18n/libphonenumber/blob/3894ee185c277ee5d0c9e81993030aaaff4a8d50/resources/PhoneNumberMetadata.xml#L1848

Do you know of a way I can manually make it work for Australia? Almost 90% of our users will be Australian.

@catamphetamine
Copy link
Owner

Well, we can make it this way:

  1. You create an issue in Google's repo describing that nationalPrefixOptionalWhenFormatting should be true for either this exact phone number format or for Australia as a whole.
  2. We see how they clarify the situation and whether they recognize this bug.
  3. Depends on 1. and 2.

@catamphetamine
Copy link
Owner

Yeah, I saw it.
Either they add that parameter to the metadata or I add that parameter manually as a workaround specially for Australia.

@catamphetamine
Copy link
Owner

Fixed in the new version

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