From 7d21081780dc15f2fb8311261dcc93456b5637d3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 19 May 2026 20:38:39 -0400 Subject: [PATCH] idk --- clio-ui/components/App.jsx | 12 ++++++++++-- clio-ui/components/Dashboard.jsx | 4 ++-- clio-ui/components/DayView.jsx | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/clio-ui/components/App.jsx b/clio-ui/components/App.jsx index 0af2466..bef834f 100644 --- a/clio-ui/components/App.jsx +++ b/clio-ui/components/App.jsx @@ -18,6 +18,14 @@ function clearStoredApiKey() { localStorage.removeItem(API_KEY_STORAGE_KEY); } +// Get local date string in YYYY-MM-DD format (not UTC) +function toLocalDateString(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; +} + // Authenticated fetch wrapper async function authFetch(url, options = {}) { const apiKey = getStoredApiKey(); @@ -364,7 +372,7 @@ function App() { setSelectedDayState(route.day); } else if (recordings.length > 0) { const sorted = [...recordings].sort((a, b) => b.startTime - a.startTime); - setSelectedDayState(sorted[0].startTime.toISOString().slice(0, 10)); + setSelectedDayState(toLocalDateString(sorted[0].startTime)); } // If URL has a recording ID, fetch it @@ -503,7 +511,7 @@ function App() { } // Export utilities for other components -Object.assign(window, { authFetch, getStoredApiKey }); +Object.assign(window, { authFetch, getStoredApiKey, toLocalDateString }); const root = ReactDOM.createRoot(document.getElementById('root')); root.render(); diff --git a/clio-ui/components/Dashboard.jsx b/clio-ui/components/Dashboard.jsx index 4fb3ea5..cbff06a 100644 --- a/clio-ui/components/Dashboard.jsx +++ b/clio-ui/components/Dashboard.jsx @@ -22,7 +22,7 @@ function Dashboard({ data, setView, setSelectedDay, setSelectedRecording }) { // Build day map const dayMap = {}; for (const r of data.recordings) { - const key = r.startTime.toISOString().slice(0, 10); + const key = window.toLocalDateString(r.startTime); if (!dayMap[key]) dayMap[key] = { count: 0, minutes: 0 }; dayMap[key].count++; dayMap[key].minutes += r.durationMinutes; @@ -145,7 +145,7 @@ function CalendarHeatmap({ dayMap, maxMinutes, onDayClick }) { for (let d = 1; d <= daysInMonth; d++) { const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(d).padStart(2, '0')}`; const info = dayMap[dateStr]; - const isToday = dateStr === new Date().toISOString().slice(0, 10); + const isToday = dateStr === window.toLocalDateString(new Date()); cells.push(
0; const intensity = hasRecs ? recs.length / maxCount : 0;