necessarylion / country-list-with-dial-code-and-flag

Country Flag with Dial Number Code
46 stars 18 forks source link

Countries with multiple area codes are restricted to a single area code #21

Closed SpencerKaiser closed 1 year ago

SpencerKaiser commented 1 year ago

Countries like the Dominican Republic and Jamaica have several area codes but the library has chosen one of several and forced it... can we either get additional countries added for the variety of area codes OR (preferably) remove the area code either entirely or remove the area code when there are multiple for a given country?

Full list of country codes can be found here with area codes being broken out into parentheses when applicable: https://en.wikipedia.org/wiki/List_of_country_calling_codes

image image
necessarylion commented 1 year ago
 { name: 'Jamaica', dial_code: '+1876', code: 'JM', flag: 'πŸ‡―πŸ‡²' },
 { name: 'Jamaica', dial_code: '+1658', code: 'JM', flag: 'πŸ‡―πŸ‡²' }, 

or

 { name: 'Jamaica', dial_code: '+1876', dial_codes: ['+1876', '+1658'], code: 'JM', flag: 'πŸ‡―πŸ‡²' },

Which one do you think is better?

SpencerKaiser commented 1 year ago

Honestly I think I would prefer the flexibility of knowing what's an area code vs what's a country code, so something like this would be my preferred option, but the second is definitely better IMO; first is simpler to use but has way too much data overlap

 { name: 'Jamaica', dial_code: '+1', area_codes: ['876', '658'], code: 'JM', flag: 'πŸ‡―πŸ‡²' },
necessarylion commented 1 year ago

Honestly I think I would prefer the flexibility of knowing what's an area code vs what's a country code, so something like this would be my preferred option, but the second is definitely better IMO; first is simpler to use but has way too much data overlap

 { name: 'Jamaica', dial_code: '+1', area_codes: ['876', '658'], code: 'JM', flag: 'πŸ‡―πŸ‡²' },

It is very nice suggestion. But This plugin is more about dial code which is country code + area code together. In your case, it is country code and area codes.

And if someone want to show list on available dial codes, then he have loop again with area codes. So I think we better stick with this solution.

{ name: 'Jamaica', dial_code: '+1876', code: 'JM', flag: 'πŸ‡―πŸ‡²' },
{ name: 'Jamaica', dial_code: '+1658', code: 'JM', flag: 'πŸ‡―πŸ‡²' }, 
SpencerKaiser commented 1 year ago

I think that's totallyΒ fine, but it'd still be a great addition to have the country code split out as a separate element. If I don't want Jamaica showing twice, I have no real options because I don't know how to split the country code from the area code. At some point in the future, adding country_code in addition to dial_code would be great, even if the country code is redundant on the dial code field.