Set global time zone

You can set the default timezone in Moment by using:

moment.tz.setDefault(String);

For example

moment.tz.setDefault("America/New_York");

  1. npm install moment-timezone
  2. var moment = require('moment-timezone'); and use this object instead of usual moment.
  3. moment.tz.setDefault(String); where String is a time zone identifier.

For example:

var moment = require('moment-timezone');
moment.tz.setDefault("America/New_York");

Docs: https://momentjs.com/timezone/docs/


Use the moment-timezone library found on the same website: http://momentjs.com/timezone/ It let's you do things like:

moment(utcDateTime).tz(settings.timezone).format(settings.dateFormat);

I recommend implementing a user class/object that has a service function for translating UTC to the user's timezone. Have a look at this fiddle:

http://jsfiddle.net/guidosch/ofd4unhu/4/

The dates are served as UTC, but the view uses the date formatting method of the user class to adjust and format the UTC date according to the user's preferences.