update TableList.tsx, date.ts and isStringEmpty.ts
This commit is contained in:
parent
67e0687be1
commit
d8404e219f
|
|
@ -240,6 +240,7 @@ export const TableList: React.FC<any> = ({
|
|||
header: ({ table }) => (
|
||||
<Checkbox
|
||||
id="terms"
|
||||
className="text-white"
|
||||
checked={table.getIsAllRowsSelected()}
|
||||
onClick={(e) => {
|
||||
table.getToggleAllRowsSelectedHandler();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -3,4 +3,10 @@ export const isStringEmpty = (input: string | null | undefined): boolean => {
|
|||
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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue