Closed mikeraynham closed 6 years ago
Thanks!
Thanks, sorry for missing this in https://github.com/DrHyde/perl-modules-Number-Phone/pull/81!
As a follow-up to this, I've just deleted the tests for Mexico, as they've switched (as of a month ago) to a nice simple Everything Is Ten Digits plan, with no Lovecraftian weirdness. See https://en.wikipedia.org/wiki/Telephone_numbers_in_Mexico
libphonenumber only applies the national prefix transform rule if the last possible capture group of the national prefix rule regex matches. That is, it won't apply the transform rule if there are no prefixes to transform. Where there are no suitable captures, it will simply delete the matching prefix. See:
com.google.i18n.phonenumbers.maybeStripNationalPrefixAndCarrierCode()
The Number::Phone country stub files, however, always apply the transform rule. This can lead to cases where phone numbers are incorrectly converted to the wrong type. For example, the international format for Argentinian mobile numbers requires the trunk code 0 to be removed, 9 to be placed before the area code, and the mobile prefix 15 to be removed, so:
But Number::Phone incorrectly does the same for fixed line numbers:
It should be:
This branch makes the Number::Phone country stub classes more closely follow the logic in libphonenumber.