minute为分钟,可更改为小时,秒或毫秒,具体看官方说明
const m1 = moment(start)
const m2 = moment(end)
var duration = moment.duration(m2.diff(m1))
var hours = duration.asHours();
if (hours - 11.5 < 1) {
hours = 0
} else {
hours -= 11.5
}
return Math.floor(hours)
网友评论