From 5cb8327758b2636a1f82d9659f89464b4dbd6093 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Tue, 28 Oct 2025 10:24:19 +0400 Subject: fix/frontend: timeline to continue until today (#292) --- frontend/src/pages/Homepage.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/Homepage.tsx b/frontend/src/pages/Homepage.tsx index 88290dd..77dc220 100644 --- a/frontend/src/pages/Homepage.tsx +++ b/frontend/src/pages/Homepage.tsx @@ -20,7 +20,7 @@ const Homepage: React.FC = () => { }; const sortedData = [...data].sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()); const startDate = new Date(sortedData[0].date); - const endDate = new Date(sortedData[sortedData.length - 1].date); + const today = new Date(); const result: PortalCountData[] = []; let currentDate = new Date(startDate.getFullYear(), startDate.getMonth(), 1); @@ -28,7 +28,7 @@ const Homepage: React.FC = () => { let dataIndex = 0; let currentCount = sortedData[0].count; - while (currentDate <= endDate) { + while (currentDate <= today) { while (dataIndex < sortedData.length && new Date(sortedData[dataIndex].date) <= currentDate) { currentCount = sortedData[dataIndex].count; dataIndex++; @@ -44,7 +44,6 @@ const Homepage: React.FC = () => { currentDate = nextDate; } } - return result; }; -- cgit v1.2.3