main
alex 2024-03-09 21:59:22 +01:00
parent 9b9244a527
commit e974ce9c27
1 changed files with 7 additions and 5 deletions

View File

@ -154,11 +154,17 @@ export default function CrmTest() {
}; };
const sorterDates = (a, b) => { const sorterDates = (a, b) => {
let cA = a === Constants.TEXT_EMPTY_PLACEHOLDER ? 0 : new Date(a);
let cB = b === Constants.TEXT_EMPTY_PLACEHOLDER ? 0 : new Date(b);
return cA - cB;
/*
return a === Constants.TEXT_EMPTY_PLACEHOLDER return a === Constants.TEXT_EMPTY_PLACEHOLDER
? 0 ? 0
: new Date(a) - b === Constants.TEXT_EMPTY_PLACEHOLDER : new Date(a) - b === Constants.TEXT_EMPTY_PLACEHOLDER
? 0 ? 0
: new Date(b); : new Date(b); */
}; };
const handleSearch = (selectedKeys, confirm, dataIndex) => { const handleSearch = (selectedKeys, confirm, dataIndex) => {
@ -324,7 +330,6 @@ export default function CrmTest() {
dataIndex: "createdAt", dataIndex: "createdAt",
key: "createdAt", key: "createdAt",
sorter: (a, b) => sorterDates(a.createdAt, b.createdAt), sorter: (a, b) => sorterDates(a.createdAt, b.createdAt),
sortDirections: ["descend"],
}, },
{ {
title: t("crm.table.telephone"), title: t("crm.table.telephone"),
@ -345,21 +350,18 @@ export default function CrmTest() {
dataIndex: "lastContact", dataIndex: "lastContact",
key: "lastContact", key: "lastContact",
sorter: (a, b) => sorterDates(a.lastContact, b.lastContact), sorter: (a, b) => sorterDates(a.lastContact, b.lastContact),
sortDirections: ["descend"],
}, },
{ {
title: t("crm.table.updatedAt"), title: t("crm.table.updatedAt"),
dataIndex: "updatedAt", dataIndex: "updatedAt",
key: "updatedAt", key: "updatedAt",
sorter: (a, b) => sorterDates(a.updatedAt, b.updatedAt), sorter: (a, b) => sorterDates(a.updatedAt, b.updatedAt),
sortDirections: ["descend"],
}, },
{ {
title: t("crm.table.createdBy"), title: t("crm.table.createdBy"),
dataIndex: "createdBy", dataIndex: "createdBy",
key: "createdBy", key: "createdBy",
sorter: (a, b) => a.createdBy - b.createdBy, sorter: (a, b) => a.createdBy - b.createdBy,
sortDirections: ["descend"],
}, },
]; ];
}; };