if (canSelectList?.length && tradeTime) {
const sorter = canSelectList.sort((a, b) => a.toString() - b.toString());
const weekDay = [7, 1, 2, 3, 4, 5, 6];
const myDate = new Date(
Date.parse(moment(tradeTime).format('YYYY/MM/DD'))
);
const index = sorter.findIndex((item) => item.toString() === tradeTime);
const day = weekDay[myDate.getDay()] - 1;
const lastDate = moment(sorter[index - day]?.toString());
setRef?.setTime([lastDate, moment(tradeTime)]);
setDate({
startDate: moment(lastDate).format('YYYY-MM-DD'),
endDate: moment(tradeTime).format('YYYY-MM-DD'),
});
}
如何获取当前周的数据
最新推荐文章于 2024-08-26 20:25:07 发布