我们以计算两个时间相差多少个小时为例
首先引入momentjs
import moment from "moment";
如果时间只有时分秒
let date = moment(addModel.value.closingTime, "hh:mm:ss").diff(
moment(addModel.value.workShiftTime, "hh:mm:ss"),
"hours"
);//计算下上班时间的时差
如果时间是年月日时分秒
let date = moment(addModel.value.closingTime )
.diff(moment(addModel.value.workShiftTime),
"hours" );