From f3d7f2ac1d35c4ed06ec072451e70966af7e099d Mon Sep 17 00:00:00 2001 From: Jordan Ramos Date: Tue, 12 May 2026 14:57:15 -0600 Subject: [PATCH] Fix archive bar chart: fmtDate now handles ISO datetime strings from PostgreSQL date columns --- frontend/src/components/pages/IvantiCountsChart.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/pages/IvantiCountsChart.js b/frontend/src/components/pages/IvantiCountsChart.js index 3f3473f..c30b8fb 100644 --- a/frontend/src/components/pages/IvantiCountsChart.js +++ b/frontend/src/components/pages/IvantiCountsChart.js @@ -170,13 +170,15 @@ function ArchiveTooltip({ active, payload, label }) { } // --------------------------------------------------------------------------- -// Shorten YYYY-MM-DD to MM/DD/YY +// Shorten YYYY-MM-DD (or ISO datetime) to MM/DD/YY // --------------------------------------------------------------------------- function fmtDate(d) { if (!d) return ''; - const p = d.split('-'); + // Handle ISO datetime strings (e.g. "2026-05-12T06:00:00.000Z") — extract date part first + const dateStr = String(d).split('T')[0]; + const p = dateStr.split('-'); if (p.length === 3) return `${p[1]}/${p[2]}/${p[0].slice(2)}`; - return d; + return dateStr; } // Extract YYYY-MM-DD from a datetime string