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
support Japanese 0x0 non-Geographic area codes with 11 digits numbers #239
Conversation
support Japanese 0x0 non-Geographic area codes with 11 digits numbers
Thanks for your contribution! :) |
Would you mind adding some specs for these cases? I'm starting to wonder if it actually does what you'd like. |
Will certainly do. I am honestly on the fence with this change as well and I have been pondering whether it's semantically correct or not (in spite of the fact that I am sure it works to cover my specific original use case). As I discovered yesterday, a valid JP cell phone looks like this:
that is an 11 digits number with 070 as non geographical national code.
that is the initial 0 of 070 must be omitted. That makes it a 10 digits phone number. Since this gem wants number always preceded by country codes, my change might be not necessary or incorrect. I'll investigate more on how phony and phony_rails interact and devise a plan. Thanks for your patience. |
Hi, That zero is the trunk prefix (0 in Japan). Sorry for not spotting this in your PR - I misremembered how Japan's numbers work. Would you mind changing this to use a trunk code, removing/fixing the 0x0, and adding specs for calls from inside Japan (with the trunk prefix)? Cheers! On Wed, Apr 1, 2015 at 6:03 AM, Michele Caramello
|
I was looking into this and I am having a senior moment. I hope you can clarify for me. Based on my late finding and confirmed by your understanding, my change should be entirely removed because the Japan country definition already specifies a 0 'trunk' code: https://github.com/floere/phony/blob/master/lib/phony/countries/japan.rb#L423 Let me check my understanding with you:
I want to add a spec for this but the last bit confuses me: does this gem support internal phone numbers that don't contain a country code? Through this format: https://github.com/floere/phony/blob/master/spec/functional/normalize_spec.rb#L115? Thanks for your help. |
Re the first part: your understanding is completely correct. Currently the best place is the countries_spec.rb for country specific specs. The API using countries |
I will revert your change, but will be happy to accept other pull requests. Thanks for your interest, help and work :) |
Sounds reasonable. |
Not a problem at all, I really appreciate your work! It actually turned our to inspire somebody else (in #240) to also give input. Cheers! |
Basing on https://en.wikipedia.org/wiki/Telephone_numbers_in_Japan#Non-geographic_area_codes + https://en.wikipedia.org/wiki/Telephone_numbers_in_Japan#Length_of_numbers
there are 11 digits long Japanese numbers that have Non geographic area codes 020, 030, 040, 050, 060, 070, 080, 090 (note that 010 is not included since it has special purpose).
This means valid phone numbers such as '+81 070 1234 5789' are rejected.
According to the same section, also 10 digits numbers with the same non geographic area codes could exist but when I tried modifying like this:
'+81 070 1234 5789' -like numbers started getting rejected whereas '+81 070 123 5789' were accepted. Leaving those aside for now while I figure out where these types of numbers are coming from.