reduce() 를 이용해 날짜가 포함된 객체 요소를 가진 배열
날짜별로 분류하기
const ordersList = payHistoryList.reduce((acc: any, order: any) => {
const date = dayjs(order.payment_date).format('YYYY-MM-DD');
if (!acc[date]) {
acc[date] = [];
}
acc[date].push(order);
return acc;
}, {});
const sortedDates = Object.keys(ordersList).sort(
(a, b) => Date.parse(b) - Date.parse(a)
);