1var duration = moment.duration(end.diff(startTime));
2var hours = duration.asHours();
1// moment version => 2.13.0.
2const start = moment().subtract(1, 'days');
3const end = new Date();
4const actual = moment().subtract(1, 'hours');
5const test = moment(actual).isBetween(start, end);
6console.log(test);
7
8// moment version < 2.13.0.
9var startDate = new Date(2013, 1, 12)
10 , endDate = new Date(2013, 1, 15)
11 , date = new Date(2013, 2, 15)
12 , range = moment().range(startDate, endDate);
13range.contains(date);