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

cell_phone_in_e164 returning invalid e164 phone number prefix for en-AU and en-NZ locales #2686

Closed
tohagan opened this issue Jan 19, 2023 · 3 comments

Comments

@tohagan
Copy link

tohagan commented Jan 19, 2023

Describe the bug

Faker::PhoneNumber.cell_phone_in_e164 returns invalid cell phone numbers for en-AU and en-NZ locales.

To Reproduce

Faker version is 2.18.0

Faker::Config.locale = 'en-AU'
Faker::PhoneNumber.cell_phone_in_e164

  • Consistently returns invalid cell phone numbers prefixed by +6104.... instead of +614 (zero removed)

Faker::Config.locale = 'en-NZ'
Faker::PhoneNumber.cell_phone_in_e164

  • always returns invalid cell phone numbers prefixed by +6402.... instead of +642 (zero removed)
  • Example returned "+640211398065" but should be "+64211398065"

National dialing in AU and NZ uses a 0 prefix
International dialing in AU and NZ replaces the 0 prefix with +61 (AU) or +64 (NZ)

@thdaraujo
Copy link
Contributor

thdaraujo commented Feb 28, 2023

thanks for bringing this to our attention!

I did a bit of research on this, but it's not clear to me whether this is true only for specific countries or locales, or for any country/locale.

I could only find this information here about the leading zero:

In a number of countries, local dialing may require the addition of a '0' in front of the subscriber number. With E.164 formatting, this '0' must usually be removed.
Source - Twilio

Can you point me to a source that says the leading zero should be removed from all area codes in all countries? Otherwise, we might have to patch it only for specific countries. Thanks!

@thdaraujo
Copy link
Contributor

@tohagan do you think this could be related to this other issue? #2047

@stefannibrasil
Copy link
Contributor

Thanks for reporting this bug! To help with bug triage, I will mark this one as duplicate of #2047

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

No branches or pull requests

3 participants