import { CalendarDate } from '../types'; const monthsData = (dates: Array) => { const parsedDates = dates.reduce( (acc: { [key: string]: Array }, date: CalendarDate) => { const monthKey = `${date.year}-${date.month}`; const month = acc[monthKey] || []; acc[monthKey] = [...month, date]; return acc; }, {}, ); return Object.entries>(parsedDates); }; export default monthsData;