const countDown = () => { let start = moment(new Date());//获取开始时间 let end = moment(new Date("2021-7-8 15:41:00"));//结束时间 let diff = end.diff(start);//时间差 let isArrived = diff < 0; let durationTime = moment.duration(diff) return `${durationTime.days()} 天 ${durationTime.hours()} 时 ${durationTime.minutes()} 分 ${durationTime.seconds()} 秒`; } console.log(11, countDown())