joost / phony_rails

This Gem adds useful methods to your Rails app to validate, display and save phone numbers. It uses the super awesome Phony gem (https://github.com/floere/phony).
MIT License
555 stars 111 forks source link

Problem with normalizing Estonian number #187

Closed zorar4ik closed 6 years ago

zorar4ik commented 6 years ago

Greetings, I have met weird issue trying normalize 2 similar numbers. Quick example phone1 = "0037253400030", phone2 = "0037275016183" They are both have 13 chars and both start with '00372' which leads to EE country code (Estonia). However when I try normalize them:

[39] pry(main)> PhonyRails.normalize_number(phone1, country_code: 'EE')
=> "+37253400030"
[40] pry(main)> PhonyRails.normalize_number(phone2, country_code: 'EE')
=> "+37237275016183"

Am I missing something?

P.S I tried not to specify country code and I have got this result:

[42] pry(main)> PhonyRails.normalize_number(phone1) => "+37253400030";
[41] pry(main)> PhonyRails.normalize_number(phone2)   => "37275016183"
joost commented 6 years ago

Seems it works already.

zorar4ik commented 5 years ago

@joost hi again. Sorry for late response. I have updated gem to version 0.14.11 but it didn't help me. roman$ bundle show phony_rails /usr/local/bundle/gems/phony_rails-0.14.11 Same situation with normalizing:

[1] pry(main)> phone1 = "0037253400030"
=> "0037253400030"
[2] pry(main)> phone2 = "0037275016183" 
=> "0037275016183"
[3] pry(main)> PhonyRails.normalize_number(phone1, country_code: 'EE')
=> "+37253400030"
[4] pry(main)> PhonyRails.normalize_number(phone2, country_code: 'EE')
=> "+37237275016183"