Format resolution_date as YYYY-MM-DD in compliance table

Normalize the date in groupByHostname() to handle PostgreSQL Date objects,
and add .slice(0,10) in the frontend render as a safety net. Prevents the
full ISO timestamp (2026-05-15T00:00:00.000Z) from displaying in the table.
This commit is contained in:
Jordan Ramos
2026-05-27 13:06:39 -06:00
parent d65411b0d7
commit 56e3f5f973
2 changed files with 5 additions and 2 deletions

View File

@@ -238,7 +238,10 @@ function groupByHostname(rows, noteHostnames) {
if ((row.seen_count || 1) > dev.seen_count) dev.seen_count = row.seen_count;
if (row.first_seen && (!dev.first_seen || row.first_seen < dev.first_seen)) dev.first_seen = row.first_seen;
if (row.last_seen && (!dev.last_seen || row.last_seen > dev.last_seen)) dev.last_seen = row.last_seen;
if (row.resolution_date && !dev.resolution_date) dev.resolution_date = row.resolution_date;
if (row.resolution_date && !dev.resolution_date) {
const rd = row.resolution_date;
dev.resolution_date = typeof rd === 'string' ? rd.slice(0, 10) : (rd instanceof Date ? rd.toISOString().slice(0, 10) : rd);
}
if (row.remediation_plan && !dev.remediation_plan) dev.remediation_plan = row.remediation_plan;
}
return Object.values(deviceMap).map(({ _seenMetricIds, ...dev }) => dev);

View File

@@ -881,7 +881,7 @@ function DeviceRow({ device, selected, onClick }) {
{/* Resolution Date */}
<div style={{ fontFamily: 'monospace', fontSize: '0.72rem', color: '#94A3B8' }}>
{device.resolution_date || '—'}
{device.resolution_date ? device.resolution_date.slice(0, 10) : '—'}
</div>
{/* Remediation Plan */}