adjust formating of numbers and dates to work with mysql

This commit is contained in:
2024-07-11 14:06:03 +02:00
parent 058c061754
commit 6bf181525c

View File

@@ -100,7 +100,10 @@ export const DataTable = ({
cell: ({ row }) => { cell: ({ row }) => {
const value = row.getValue(column_name) as any; const value = row.getValue(column_name) as any;
let finalValue = value; let finalValue = value;
if (formatDates && udt_name === "timestamp") { if (
formatDates &&
["timestamp", "datetime"].includes(udt_name.toLowerCase())
) {
finalValue = new Date(value as string).toLocaleString(); finalValue = new Date(value as string).toLocaleString();
} }
if (showImagesPreview && typeof value === "string" && isUrl(value)) { if (showImagesPreview && typeof value === "string" && isUrl(value)) {
@@ -129,7 +132,11 @@ export const DataTable = ({
} }
return ( return (
<div <div
className={cn("break-all", data_type === "integer" && "text-right")} className={cn(
"break-all",
["integer", "int", "tinyint", "double"].includes(data_type) &&
"text-right",
)}
> >
{finalValue} {finalValue}
</div> </div>