moment-timezone
moment-timezone copied to clipboard
Add full country name
Moment-timezone version which you use:
Version: 0.5.34
Issue description:
At the moment(no pun intended) only country code is available via timezone. It would be nice to have country name also available.
Moment Timezone gets its underlying data from the IANA time zone database, which only provides the two-letter ISO codes for countries.
Getting the full country name data into Moment Timezone would require integrating another data source, such as the Unicode Common Locale Data Repository (CLDR). This is not a simple task, and it's likely way out of scope for the maintenance-only status of this project. Part of the problem is translations and locales, because there would need to be a full list of country names for each different locale.
it appears that the data is already available here
Ah yes, I'd missed that, good point! But it still doesn't solve the locale problem. For example, if a user runs moment.locale('es'), then calls an API that returns a country name and gets "United States" instead of "Estados Unidos", that's going to cause confusion.
Even the existing English-language names in that data file are inconsistent with official naming conventions (e.g. "Congo (Dem. Rep.)" instead of "DR Congo" or "Democratic Republic of the Congo".)
@abdullah2993 as part of the moment-timezone release (the code), the data and the metadata is also released. So you're free to pick whatever suits your needs from the data/metadata directly.
Also you could use the "source" data from tzdata (not official) or the CLDR data that @gilmoreorless pointed out (more official, also available in all languages).
It's called moment-timezone not country-code-to-name for a reason.