diff --git a/frontend/src/features/vehicles/mobile/VehicleDetailMobile.tsx b/frontend/src/features/vehicles/mobile/VehicleDetailMobile.tsx index bef18a7..b241054 100644 --- a/frontend/src/features/vehicles/mobile/VehicleDetailMobile.tsx +++ b/frontend/src/features/vehicles/mobile/VehicleDetailMobile.tsx @@ -142,7 +142,9 @@ export const VehicleDetailMobile: React.FC = ({ secondaryParts.push(new Date(rec.date).toLocaleDateString()); secondaryParts.push('Maintenance'); const secondary = secondaryParts.join(' • '); - const amount = typeof rec.cost === 'number' ? `$${rec.cost.toFixed(2)}` : undefined; + // Backend returns numeric/decimal columns as strings via node-postgres; coerce. + const costNum = rec.cost != null ? Number(rec.cost) : NaN; + const amount = Number.isFinite(costNum) ? `$${costNum.toFixed(2)}` : undefined; list.push({ id: rec.id, type: 'Maintenance', diff --git a/frontend/src/features/vehicles/pages/VehicleDetailPage.tsx b/frontend/src/features/vehicles/pages/VehicleDetailPage.tsx index 65e7e0f..4bdce5b 100644 --- a/frontend/src/features/vehicles/pages/VehicleDetailPage.tsx +++ b/frontend/src/features/vehicles/pages/VehicleDetailPage.tsx @@ -148,7 +148,9 @@ export const VehicleDetailPage: React.FC = () => { if (subtypeText) parts.push(subtypeText); if (rec.shopName) parts.push(rec.shopName); const summary = parts.join(' • '); - const amount = typeof rec.cost === 'number' ? `$${rec.cost.toFixed(2)}` : undefined; + // Backend returns numeric/decimal columns as strings via node-postgres; coerce. + const costNum = rec.cost != null ? Number(rec.cost) : NaN; + const amount = Number.isFinite(costNum) ? `$${costNum.toFixed(2)}` : undefined; list.push({ id: rec.id, type: 'Maintenance', date: rec.date, summary, amount }); } }