diff --git a/src/components/CommunityPortal/CPDashboard.jsx b/src/components/CommunityPortal/CPDashboard.jsx index 8baf7053c4..1d8f1644e5 100644 --- a/src/components/CommunityPortal/CPDashboard.jsx +++ b/src/components/CommunityPortal/CPDashboard.jsx @@ -41,6 +41,7 @@ export function CPDashboard() { const [isLoading, setIsLoading] = useState(false); const [dateFilter, setDateFilter] = useState(''); const [error, setError] = useState(null); + const [selectedDate, setSelectedDate] = useState(''); const darkMode = useSelector(state => state.theme.darkMode); const [pagination, setPagination] = useState({ currentPage: 1, @@ -133,6 +134,15 @@ export function CPDashboard() { if (!isOnlineEvent) return false; } + // Filter by specific date if one is selected + if (selectedDate) { + const eventDate = new Date(event.date); + const filterDate = new Date(selectedDate); + eventDate.setHours(0, 0, 0, 0); + filterDate.setHours(0, 0, 0, 0); + if (eventDate.getTime() !== filterDate.getTime()) return false; + } + // Filter by date filter if (dateFilter === 'tomorrow') { return isTomorrow(event.date); @@ -265,11 +275,27 @@ export function CPDashboard() {