Add older_than_absolute_date operator

Summary: Doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU/edit#heading=h.pg8svtdjlx7

Reviewed By: lblasa, antonk52

Differential Revision: D49232777

fbshipit-source-id: ec82faca4690d099c6c9d0427c569bfe2a9dd233
This commit is contained in:
Andrey Goncharov
2023-09-14 04:48:12 -07:00
committed by Facebook GitHub Bot
parent 7a6d895aa8
commit ea1d2e9813

View File

@@ -141,6 +141,12 @@ export const dataTablePowerSearchOperators = {
valueType: 'ABSOLUTE_DATE',
dateOnly: true,
}),
older_than_absolute_date: () => ({
key: 'older_than_absolute_date',
label: 'is before',
valueType: 'ABSOLUTE_DATE',
dateOnly: false,
}),
} satisfies {
[key: string]: (...args: any[]) => OperatorConfig;
};
@@ -219,4 +225,8 @@ export const dataTablePowerSearchOperatorProcessorConfig = {
const valueNormalized = dayjs(value);
return valueNormalized.isAfter(searchValue);
},
older_than_absolute_date: (_operator, searchValue: Date, value: any) => {
const valueNormalized = dayjs(value);
return valueNormalized.isBefore(searchValue);
},
} satisfies PowerSearchOperatorProcessorConfig;