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 }) => (
|
header: ({ table }) => (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id="terms"
|
id="terms"
|
||||||
|
className="text-white"
|
||||||
checked={table.getIsAllRowsSelected()}
|
checked={table.getIsAllRowsSelected()}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
table.getToggleAllRowsSelectedHandler();
|
table.getToggleAllRowsSelectedHandler();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import day from "dayjs";
|
import day from "dayjs";
|
||||||
import relative from "dayjs/plugin/relativeTime";
|
import relative from "dayjs/plugin/relativeTime";
|
||||||
|
import { empty } from "./isStringEmpty";
|
||||||
|
|
||||||
day.extend(relative);
|
day.extend(relative);
|
||||||
|
|
||||||
|
|
@ -11,7 +12,8 @@ export const longDate = (date: string | Date) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const dayDate = (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 day(date).format("DD MMMM YYYY");
|
||||||
}
|
}
|
||||||
return "-";
|
return "-";
|
||||||
|
|
@ -33,7 +35,6 @@ export const normalDate = (date: string | Date) => {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const timeAgo = (date: string | Date) => {
|
export const timeAgo = (date: string | Date) => {
|
||||||
if (date instanceof Date || typeof date === "string") {
|
if (date instanceof Date || typeof date === "string") {
|
||||||
return day(date).fromNow();
|
return day(date).fromNow();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
export const isStringEmpty = (input: string | null | undefined): boolean => {
|
export const isStringEmpty = (input: string | null | undefined): boolean => {
|
||||||
if (input === null || input === undefined) {
|
if (input === null || input === undefined) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return input.trim().length === 0;
|
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