From 2a51982c28f1f13acdf9935fb6cd5fc138eda0b5 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Mon, 19 Jan 2026 18:44:57 +0100 Subject: [PATCH] fix: update Chart component to display time correctly at midnight for hourly intervals --- components/dashboard/Chart.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/dashboard/Chart.tsx b/components/dashboard/Chart.tsx index 5ae0855..a5cfce9 100644 --- a/components/dashboard/Chart.tsx +++ b/components/dashboard/Chart.tsx @@ -163,7 +163,11 @@ export default function Chart({ data, prevData, stats, prevStats, interval }: Ch if (interval === 'minute') { formattedDate = new Date(item.date).toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' }) } else if (interval === 'hour') { - formattedDate = new Date(item.date).toLocaleTimeString('en-US', { hour: 'numeric', minute: 'numeric' }) + const d = new Date(item.date) + const isMidnight = d.getHours() === 0 && d.getMinutes() === 0 + formattedDate = isMidnight + ? d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }) + : d.toLocaleTimeString('en-US', { hour: 'numeric', minute: 'numeric' }) } else { formattedDate = new Date(item.date).toLocaleDateString('en-US', { month: 'short', day: 'numeric' }) }