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(