moment实现计算两个时间的差值
var m1 = moment('2018-08-14 11:00:00'), m2 = moment('2018-08-14 12:10:00'); console.log(m1) console.log(m2) console.log(m2.diff(m1, 'minute'));
minute为分钟,可更改为秒或毫秒('hort', 'day', 'second', 'minute', 'week', 'year'),具体看官方说明
var m1 = moment('2018-08-14 11:00:00'), m2 = moment('2018-08-14 12:10:00'); console.log(m1) console.log(m2) console.log(m2.diff(m1, 'minute'));
minute为分钟,可更改为秒或毫秒('hort', 'day', 'second', 'minute', 'week', 'year'),具体看官方说明