【发布时间】:2021-08-09 14:40:48
【问题描述】:
如何通过在 react 中使用 Moment.js 来获得没有周末的两个日期之间的差异。这是我的代码
useEffect(() => {
if (dates && dates.length > 1) {
const startDate = dates[0];
const endDate = dates[1];
if (startDate && endDate) {
const diff = endDate.startOf('day').diff(startDate.startOf('day'), 'days') + 1;
}
//this will return to me the different between two dates with Weekend Days
}
}, [dates]);
【问题讨论】: