Skip to content

Commit bc90a3d

Browse files
committed
feat: added formatTimestamp for TimeStamp columns
1 parent 85bfce5 commit bc90a3d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/components/shared/DataTable.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
1010
import { Database, Pencil, Trash2 } from "lucide-react";
1111
import { Button } from "@/components/ui/button";
12+
import { formatTimestamp } from "@/lib/utils";
1213

1314
interface DataTableProps {
1415
data: Array<Record<string, any>>;
@@ -173,7 +174,7 @@ function formatCellValue(value: any): React.ReactNode {
173174
if (value instanceof Date) {
174175
return (
175176
<span className="text-violet-600 dark:text-violet-400">
176-
{value.toLocaleString()}
177+
{formatTimestamp(value.toISOString())}
177178
</span>
178179
);
179180
}
@@ -196,7 +197,7 @@ function formatCellValue(value: any): React.ReactNode {
196197

197198
// Check if it looks like a date string
198199
if (/^\d{4}-\d{2}-\d{2}/.test(strValue)) {
199-
return <span className="text-violet-600 dark:text-violet-400">{strValue}</span>;
200+
return <span className="text-violet-600 dark:text-violet-400">{formatTimestamp(strValue)}</span>;
200201
}
201202

202203
// Check if it looks like an ID or UUID

0 commit comments

Comments
 (0)