Monday, November 23, 2015

MomentJS Notes


npm i moment --save
npm i moment-timezone --save


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

Create moments in and out of DST:

var cdt ="2015-07-23 08:30", "America/Chicago");
var cst ="2015-11-23 08:30", "America/Chicago");

Check that offset from UTC is what you'd expect:'America/New_York').format()
> '2015-07-23T09:30:00-04:00''America/New_York').format()
> '2015-11-23T09:30:00-05:00'

Check that zone aware format output is what you'd expect:'America/New_York').format('HH:mm:ss')
> '09:30:00''America/New_York').format('HH:mm:ss')
> '09:30:00'

No comments:

Post a Comment