diff --git a/components/tablelist/TableList.tsx b/components/tablelist/TableList.tsx index a52092d..4b0bb22 100644 --- a/components/tablelist/TableList.tsx +++ b/components/tablelist/TableList.tsx @@ -240,6 +240,7 @@ export const TableList: React.FC = ({ header: ({ table }) => ( { table.getToggleAllRowsSelectedHandler(); diff --git a/utils/date.ts b/utils/date.ts index db812b9..113a35a 100644 --- a/utils/date.ts +++ b/utils/date.ts @@ -1,5 +1,6 @@ import day from "dayjs"; import relative from "dayjs/plugin/relativeTime"; +import { empty } from "./isStringEmpty"; day.extend(relative); @@ -11,7 +12,8 @@ export const longDate = (date: string | Date) => { }; export const dayDate = (date: string | Date) => { - if (date instanceof Date || typeof date === "string") { + console.log({ date }); + if (date instanceof Date || (typeof date === "string" && !empty(date))) { return day(date).format("DD MMMM YYYY"); } return "-"; @@ -33,7 +35,6 @@ export const normalDate = (date: string | Date) => { return null; }; - export const timeAgo = (date: string | Date) => { if (date instanceof Date || typeof date === "string") { return day(date).fromNow(); diff --git a/utils/isStringEmpty.ts b/utils/isStringEmpty.ts index ad157ff..5ff618e 100644 --- a/utils/isStringEmpty.ts +++ b/utils/isStringEmpty.ts @@ -1,6 +1,12 @@ export const isStringEmpty = (input: string | null | undefined): boolean => { - if (input === null || input === undefined) { - return true; - } - return input.trim().length === 0; - }; \ No newline at end of file + if (input === null || input === undefined) { + return true; + } + return input.trim().length === 0; +}; +export const empty = (input: string | null | undefined): boolean => { + if (input === null || input === undefined) { + return true; + } + return input.trim().length === 0; +};