function getDuration(startDate: any, endDate: any) {
if (endDate && startDate) {
const end = new Date(endDate).getTime();
const start = new Date(startDate).getTime();
const iDays = (end - start) / 1000 / 60 / 60 / 24; //把相差的毫秒数转换为天数
const duration = iDays.toFixed(1); //把相减的天数差保留一位小数
return duration;
}
return "";
}
const durationFilter = (start: any, end: any) => {
return getDuration(start, end);
};
export default durationFilter;
-
由 jiangzaicheng 提交于b6851288