You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed cases of unexpected behaviour of parsePhoneNumber, where it successfully detects a country calling code, as evidenced by the fact that it returns regionCode, the two-letter ISO country code, but it does not return a countryCode, the calling code itself, as it normally would.
It happens when the input is just the calling code, and between 0 to 2 numbers.
The countryCode can be mapped from regionCode by using getCountryCodeForRegionCode, so it is not a dealbreaker, just an inconvenience.
"+1" is not a valid phone number, it finding the region code is more of an interesting coincidence than something technically supported. The code internally only does a reverse lookup once a real phone number is found (because it might actually not be US just because it starts with "+1").
Use the getRegionCodeForCountryCode if you want to convert +1 to US and getCountryCodeForRegionCode for the other way around.
Version
5.10.0
Description
I have noticed cases of unexpected behaviour of
parsePhoneNumber
, where it successfully detects a country calling code, as evidenced by the fact that it returnsregionCode
, the two-letter ISO country code, but it does not return acountryCode
, the calling code itself, as it normally would.It happens when the input is just the calling code, and between 0 to 2 numbers.
The
countryCode
can be mapped fromregionCode
by usinggetCountryCodeForRegionCode
, so it is not a dealbreaker, just an inconvenience.Steps to reproduce
Returns both properties: ✅
Does not return
countryCode
❌ :The text was updated successfully, but these errors were encountered: