momentjs check year diff in date code example
Example 1: moment check days of difference between days
var a = moment([2007, 0, 29]);
var b = moment([2007, 0, 28]);
a.diff(b, 'days')
Example 2: calculate time difference in hrs moment
var duration = moment.duration(end.diff(startTime));
var hours = duration.asHours();