// 根據(jù)第一天獲取整周的日期
export const getSeventDays = (firstDay) => {
? const currentDate = new Date(firstDay);
? const timesStamp = currentDate.getTime();
? const currenDay = currentDate.getDay();
? const num2 = 2;
? const num6 = 6;
? const num7 = 7;
? const num24 = 24;
? const num60 = 60;
? const num1000 = 1000;
? const daysOfThisWeek = Array.from(new Array(num7)).map((_, i) => {
? ? const date = new Date(
? ? ? timesStamp +
? ? ? ? num24 * num60 * num60 * num1000 * (i - ((currenDay + num6) % num7))
? ? );
? ? return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
? ? ? num2,
? ? ? '0'
? ? )}-${String(date.getDate()).padStart(num2, '0')}`;
? });
return daysOfThisWeek;
};