diff --git a/frontend/src/utils/fixTime.ts b/frontend/src/utils/fixTime.ts new file mode 100644 index 0000000..277f18a --- /dev/null +++ b/frontend/src/utils/fixTime.ts @@ -0,0 +1,6 @@ +import { format } from "date-fns"; + +export const fixTime = (date: any) => { + const strippedDate = date.replace("Z", ""); // Remove Z + return format(strippedDate, "MM/dd/yyyy hh:mm a"); +}; diff --git a/frontend/src/utils/tableData/production/labels/labelColumns.tsx b/frontend/src/utils/tableData/production/labels/labelColumns.tsx index d6f09e4..7f4121e 100644 --- a/frontend/src/utils/tableData/production/labels/labelColumns.tsx +++ b/frontend/src/utils/tableData/production/labels/labelColumns.tsx @@ -1,5 +1,5 @@ +import { fixTime } from "@/utils/fixTime"; import { ColumnDef } from "@tanstack/react-table"; -import { format } from "date-fns"; // This type is used to define the shape of our data. // You can use a Zod schema here if you want. @@ -33,10 +33,7 @@ export const labelolumns: ColumnDef[] = [ header: "Label Date", cell: ({ row }) => { if (row.getValue("upd_date")) { - const correctDate = format( - row.getValue("upd_date"), - "M/d/yyyy hh:mm" - ); + const correctDate = fixTime(row.getValue("created_at")); return (
{correctDate}
); diff --git a/frontend/src/utils/tableData/production/ocpLogs/ocpLogColumns.tsx b/frontend/src/utils/tableData/production/ocpLogs/ocpLogColumns.tsx index 9558028..9a265b6 100644 --- a/frontend/src/utils/tableData/production/ocpLogs/ocpLogColumns.tsx +++ b/frontend/src/utils/tableData/production/ocpLogs/ocpLogColumns.tsx @@ -1,6 +1,6 @@ import { Button } from "@/components/ui/button"; +import { fixTime } from "@/utils/fixTime"; import { ColumnDef } from "@tanstack/react-table"; -import { format } from "date-fns"; import { Trash } from "lucide-react"; // This type is used to define the shape of our data. @@ -38,10 +38,7 @@ export const ocpColumns = ( header: "Error Date", cell: ({ row }) => { if (row.getValue("created_at")) { - const correctDate = format( - row.getValue("created_at"), - "M/d/yyyy hh:mm" - ); + const correctDate = fixTime(row.getValue("created_at")); return (
{correctDate}
); diff --git a/package.json b/package.json index acb49d5..24749ac 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ } }, "admConfig": { - "build": 230, + "build": 231, "oldBuild": "backend-0.1.3.zip" }, "devDependencies": {