Moment: How to get locale code from zone name?

Created on 9 Jul 2020  ·  3Comments  ·  Source: moment/moment

I was trying to find how to get code fr from zone name ’Europe/Paris' all day, but with no luck.

I read all docs and couldn't find that function either, so i need help on this one.

Closest what i found is this. I need This function but in reverse, to pass country name and get country code.

Most helpful comment

That is great, but i don't use webpack right now.
Luckily i found solution
moment.tz.zone('America/New_York').countries()
This will get you array so you guys can easily pass that value to locale()

All 3 comments

That is great, but i don't use webpack right now.
Luckily i found solution
moment.tz.zone('America/New_York').countries()
This will get you array so you guys can easily pass that value to locale()

Glad you have found a solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Delgan picture Delgan  ·  3Comments

alvarotrigo picture alvarotrigo  ·  3Comments

dogukankotan picture dogukankotan  ·  3Comments

ninigix picture ninigix  ·  3Comments

M-Zuber picture M-Zuber  ·  3Comments