moment js compare dates code example
Example 1: compare two dates using moment
moment('2010-10-20').isAfter('2010-01-01', 'year');
moment('2010-10-20').isAfter('2009-12-31', 'year');
Example 2: moment add seconds
var travelTime = moment().add(642, 'seconds').format('hh:mm A');
var travelTime = moment().add(11, 'minutes').format('hh:mm A');
var travelTime = moment().add(2, 'hours').format('hh:mm A');
Example 3: moment to javascript date
let now = moment()
let now = now.toDate()
Example 4: moment.set
moment().set('year', 2013);
moment().set('month', 3);
moment().set('date', 1);
moment().set('hour', 13);
moment().set('minute', 20);
moment().set('second', 30);
moment().set('millisecond', 123);
moment().set({'year': 2013, 'month': 3});