Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get timezones list using moment.js library?

Tags:

momentjs

I need to make a <select> list of all actual world timezones. How do I get an array with timezones list?

like image 253
user619271 Avatar asked Jan 25 '14 08:01

user619271


People also ask

How do you get moments with time zones?

var tz = moment. tz. guess(); It will return an IANA time zone identifier, such as America/Los_Angeles for the US Pacific time zone.

Does MomentJS use local timezone?

The main moment. js library has full functionality for working with UTC and the local time zone.

Is MomentJS being deprecated?

Moment construction falls back to js Date. This is discouraged and will be removed in an upcoming major release. This deprecation warning is thrown when no known format is found for a date passed into the string constructor.

What is moment-timezone npm?

Moment-Timezone is an add-on for Moment. js. Both are considered legacy projects, now in maintenance mode. In most cases, you should choose a different library. For more details and recommendations, please see Project Status in the Moment docs.


1 Answers

First include moment-timezone with data and then you can use moment.tz.names();

like image 172
marcieng Avatar answered Oct 13 '22 21:10

marcieng