Spaces:
Sleeping
Sleeping
end today
Browse files- src/main.ts +5 -2
src/main.ts
CHANGED
|
@@ -183,15 +183,18 @@ async function handleFileUpload(event: Event): Promise<void> {
|
|
| 183 |
}
|
| 184 |
|
| 185 |
function renderCharts(activities: Activity[], targetAcwr: number): void {
|
| 186 |
-
// Calculate date range from
|
| 187 |
let dateRange: { start: Date; end: Date } | undefined;
|
| 188 |
if (allActivities.length > 0) {
|
| 189 |
const sortedAll = [...allActivities].sort((a, b) => a.date.getTime() - b.date.getTime());
|
| 190 |
// Normalize to midnight to avoid timezone/time comparison issues
|
| 191 |
const startDate = new Date(sortedAll[0].date);
|
| 192 |
startDate.setHours(0, 0, 0, 0);
|
| 193 |
-
|
|
|
|
|
|
|
| 194 |
endDate.setHours(23, 59, 59, 999);
|
|
|
|
| 195 |
dateRange = {
|
| 196 |
start: startDate,
|
| 197 |
end: endDate,
|
|
|
|
| 183 |
}
|
| 184 |
|
| 185 |
function renderCharts(activities: Activity[], targetAcwr: number): void {
|
| 186 |
+
// Calculate date range from first activity to today
|
| 187 |
let dateRange: { start: Date; end: Date } | undefined;
|
| 188 |
if (allActivities.length > 0) {
|
| 189 |
const sortedAll = [...allActivities].sort((a, b) => a.date.getTime() - b.date.getTime());
|
| 190 |
// Normalize to midnight to avoid timezone/time comparison issues
|
| 191 |
const startDate = new Date(sortedAll[0].date);
|
| 192 |
startDate.setHours(0, 0, 0, 0);
|
| 193 |
+
|
| 194 |
+
// Use current date/time as end date (today)
|
| 195 |
+
const endDate = new Date();
|
| 196 |
endDate.setHours(23, 59, 59, 999);
|
| 197 |
+
|
| 198 |
dateRange = {
|
| 199 |
start: startDate,
|
| 200 |
end: endDate,
|