feat: #1853 filter ledger entries by date (#2018)

This commit is contained in:
m.ray 2022-11-10 18:51:29 +00:00 committed by GitHub
parent 0ec511a72f
commit 7ba72e3c8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,6 @@ export const LedgerTable = ({ ...props }) => (
flex: 1,
resizable: true,
sortable: true,
filter: true,
}}
{...props}
>
@ -89,6 +88,26 @@ export const LedgerTable = ({ ...props }) => (
valueFormatter={({ value }: { value: string }) =>
getDateTimeFormat().format(fromNanoSeconds(value))
}
filter="agDateColumnFilter"
filterParams={{
comparator: (
filterLocalDateAtMidnight: number,
dateAsString: string
) => {
if (dateAsString == null) {
return 0;
}
const filterDate = new Date(filterLocalDateAtMidnight)
.getTime()
.toString();
if (dateAsString < filterDate) {
return -1;
} else if (dateAsString > filterDate) {
return 1;
}
return 0;
},
}}
/>
</AgGrid>
);