From 68efad829930b0823e2145eecb5440d659206443 Mon Sep 17 00:00:00 2001 From: Collin Barrett Date: Sat, 9 Jun 2018 14:34:21 -0500 Subject: [PATCH] handle N/A in Updated column sorting --- src/FilterLists.Web/ClientApp/components/Home.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/FilterLists.Web/ClientApp/components/Home.tsx b/src/FilterLists.Web/ClientApp/components/Home.tsx index 71ad27e56..c214e2d5f 100644 --- a/src/FilterLists.Web/ClientApp/components/Home.tsx +++ b/src/FilterLists.Web/ClientApp/components/Home.tsx @@ -98,7 +98,9 @@ export class Home extends React.Component, IHomeState> { accessor: "updatedDate", filterable: true, filterMethod: (filter: any, row: any) => row[filter.id].includes(filter.value), - sortMethod: (a: any, b: any) => a > b ? 1 : -1, + sortMethod: (a: any, b: any) => moment(a).isValid() + ? (moment(b).isValid() ? (moment(a).isBefore(b) ? -1 : 1) : 1) + : -1, Cell: (cell: any) =>
{moment(cell.value).isValid() ? moment(cell.value).format(moment.HTML5_FMT.DATE) : "N/A"}
,