diff --git a/app/components/sections/schedules/schedules.tsx b/app/components/sections/schedules/schedules.tsx index c712f58..8bae655 100644 --- a/app/components/sections/schedules/schedules.tsx +++ b/app/components/sections/schedules/schedules.tsx @@ -56,7 +56,9 @@ export const SchedulesSection = ({ ).sort((a, b) => new Date(a).getTime() - new Date(b).getTime()); const [open, setOpen] = useState(false); - const [selectedDate, setSelectedDate] = useState(sortedDates[0]); + const [selectedDate, setSelectedDate] = useState( + sortedDates[sortedDates.length - 1], + ); const [openDropdown, setOpenDropdown] = useState(false); const [selectedScheduleId, setSelectedScheduleId] = useState< ScheduleItemType["id"] | null @@ -76,7 +78,7 @@ export const SchedulesSection = ({ useEffect(() => { if (sortedDates.length > 0 && !selectedDate) { - setSelectedDate(sortedDates[0]); + setSelectedDate(sortedDates[sortedDates.length - 1]); } }, [sortedDates, selectedDate]);