intl-tel-input
intl-tel-input copied to clipboard
Invalid country data for French overseas territories
Steps to reproduce
- Have an IP from an overseas territory (such as Guadeloupe, Martinique, etc.) in France
- Load a page with intl-tel-input and IPAPI configured as geoIpLookup callback
Expected behaviour
The phone number should have a French format and a French flag should appear
Actual behaviour
The error "No country data for 'gp'" appears and no flag or format is correctly selected by default
Initialisation options
- IPAPI returns gp or mq for example for Guadeloupe and Martinique
- The code for geoIpLookup is as follows:
geoIpLookup: callback => {
fetch("https://ipapi.co/json")
.then(res => res.json())
.then(data => callback(data.country_code))
.catch(() => callback("fr"));
},
Can you log the value of data.country_code that is being passed to the callback?
Because when I test it, passing "gp", it seems to work fine: https://codepen.io/jackocnr/pen/mdYdbPa
Some more questions:
- Which version of the plugin are you using?
- Are you using any other initialisation options? e.g. onlyCountries?
- Is there a number in the input when you initialise the plugin?
Closing due to inactivity.