diff --git a/src/views/components/CalendarView.jsx b/src/views/components/CalendarView.jsx index 154b723..9a27811 100644 --- a/src/views/components/CalendarView.jsx +++ b/src/views/components/CalendarView.jsx @@ -21,11 +21,15 @@ const CalendarView = ({ chores }) => { const tileContent = ({ date, view }) => { if (view === 'month') { - const dayChores = chores.filter( - chore => - new Date(chore.nextDueDate)?.toISOString().split('T')[0] === - date.toISOString().split('T')[0], - ) + const dayChores = chores.filter(chore => { + // Validate chore.nextDueDate before using it + if (!chore.nextDueDate) return false + + const choreDate = new Date(chore.nextDueDate) + if (isNaN(choreDate)) return false // Check if the date is invalid + if (!date) return false + return choreDate.toLocaleDateString() === date.toLocaleDateString() + }) return (