diff options
Diffstat (limited to 'frontend/src/pages/Homepage.tsx')
| -rw-r--r-- | frontend/src/pages/Homepage.tsx | 5 |
1 files 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 = () => { | |||
| 20 | }; | 20 | }; |
| 21 | const sortedData = [...data].sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()); | 21 | const sortedData = [...data].sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()); |
| 22 | const startDate = new Date(sortedData[0].date); | 22 | const startDate = new Date(sortedData[0].date); |
| 23 | const endDate = new Date(sortedData[sortedData.length - 1].date); | 23 | const today = new Date(); |
| 24 | 24 | ||
| 25 | const result: PortalCountData[] = []; | 25 | const result: PortalCountData[] = []; |
| 26 | let currentDate = new Date(startDate.getFullYear(), startDate.getMonth(), 1); | 26 | let currentDate = new Date(startDate.getFullYear(), startDate.getMonth(), 1); |
| @@ -28,7 +28,7 @@ const Homepage: React.FC = () => { | |||
| 28 | let dataIndex = 0; | 28 | let dataIndex = 0; |
| 29 | let currentCount = sortedData[0].count; | 29 | let currentCount = sortedData[0].count; |
| 30 | 30 | ||
| 31 | while (currentDate <= endDate) { | 31 | while (currentDate <= today) { |
| 32 | while (dataIndex < sortedData.length && new Date(sortedData[dataIndex].date) <= currentDate) { | 32 | while (dataIndex < sortedData.length && new Date(sortedData[dataIndex].date) <= currentDate) { |
| 33 | currentCount = sortedData[dataIndex].count; | 33 | currentCount = sortedData[dataIndex].count; |
| 34 | dataIndex++; | 34 | dataIndex++; |
| @@ -44,7 +44,6 @@ const Homepage: React.FC = () => { | |||
| 44 | currentDate = nextDate; | 44 | currentDate = nextDate; |
| 45 | } | 45 | } |
| 46 | } | 46 | } |
| 47 | |||
| 48 | return result; | 47 | return result; |
| 49 | }; | 48 | }; |
| 50 | 49 | ||