mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-02 00:23:13 +00:00
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:
parent
9bae91f281
commit
b0811aae65
1 changed files with 9 additions and 1 deletions
|
|
@ -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" },
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue