Fix archive bar chart: fmtDate now handles ISO datetime strings from PostgreSQL date columns
This commit is contained in:
@@ -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) {
|
function fmtDate(d) {
|
||||||
if (!d) return '';
|
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)}`;
|
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
|
// Extract YYYY-MM-DD from a datetime string
|
||||||
|
|||||||
Reference in New Issue
Block a user