Format created date on work order list page

- Add render function to createdDate column
- Same YYYY-MM-DD HH:MM TZ format as the view page
This commit is contained in:
Adam Moussa 2026-04-16 17:59:05 -04:00
parent 9bae91f281
commit b0811aae65

View file

@ -8,7 +8,15 @@ export default function Table({ loading, error, rows, onEdit, onDelete, page, se
{ key: "location", label: "Location" },
{ key: "priority", label: "Priority" },
{ key: "status", label: "Status" },
{ key: "createdDate", label: "Created" },
{ key: "createdDate", label: "Created", render: (val) => {
if (!val) return "";
const d = new Date(val.endsWith("Z") ? val : val + "Z");
if (isNaN(d)) return val;
const date = d.toLocaleDateString("en-CA");
const time = d.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit", hour12: false });
const tz = d.toLocaleTimeString(undefined, { timeZoneName: "short" }).split(" ").pop();
return `${date} ${time} ${tz}`;
}},
{ key: "assignedTo", label: "Assigned To" },
];