From 862d059d03b05a94e8f81dcfcb0b24cc3af8e1f7 Mon Sep 17 00:00:00 2001 From: Akshith <33996844+akshith312@users.noreply.github.com> Date: Wed, 21 Jan 2026 17:01:30 -0500 Subject: [PATCH] fix: date filter fixed to display as per date selected --- .../CommunityPortal/CPDashboard.jsx | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) 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() {
-
- + { + setSelectedDate(e.target.value); + setPagination(prev => ({ ...prev, currentPage: 1 })); + }} + />