Moment Timezone0.0.5


#Where to use it

In order to use moment-timezone, you will need moment@2.6.0 or greater, the core moment-timezone library, and the moment-timezone data.

You can use the data builder at to construct a data set with only the zones needed.


npm install moment-timezone
var moment = require('moment-timezone');


<script src="moment.js"></script>
<script src="moment-timezone.js"></script>
<script src="moment-timezone-data.js"></script>


    paths: {
        "moment": "path/to/moment",
        "moment-timezone": "path/to/moment-timezone",
        "moment-timezone-data": "path/to/moment-timezone-data"
define(["moment-timezone", "moment-timezone-data"], function (moment) {

#Constructor, String);

The constructor takes all the same arguments as the moment constructor, but will interpret the last argument as a time zone identifier."2013-11-18 11:55", "America/Toronto").format(); // "2013-11-18T11:55:00-05:00" Date(2013, 11, 18), "America/Toronto").format(); // "2013-12-18T00:00:00-05:00"



The .tz mutator will set the timezone to the provided time zone identifier and update the offset.

moment("2013-11-18").tz("America/Toronto").zone(); // 300
moment("2013-11-18").tz("Europe/Berlin").zone(); // -60

This information is used consistently in other operations, like calculating the start of the day.

var m = moment("2013-11-18 11:55");"America/Toronto").format(); // "2013-11-18T11:55:00-05:00"
m.startOf("day").format(); // "2013-11-18T00:00:00-05:00""Europe/Berlin").format(); // "2013-11-18T06:00:00+01:00"