Add newer_than_absolute_date operator
Summary: Doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU/edit#heading=h.pg8svtdjlx7 Reviewed By: lblasa, antonk52 Differential Revision: D49232772 fbshipit-source-id: 578378faffd83da10df103715734603c67bebb83
This commit is contained in:
committed by
Facebook GitHub Bot
parent
51073bc665
commit
ad6b3ed4f9
@@ -7,6 +7,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import {OperatorConfig} from '../PowerSearch';
|
||||
import {FloatOperatorConfig} from '../PowerSearch/PowerSearchConfig';
|
||||
|
||||
@@ -128,6 +129,12 @@ export const dataTablePowerSearchOperators = {
|
||||
key: 'is_nullish',
|
||||
valueType: 'NO_VALUE',
|
||||
}),
|
||||
newer_than_absolute_date: () => ({
|
||||
key: 'newer_than_absolute_date',
|
||||
label: 'is after',
|
||||
valueType: 'ABSOLUTE_DATE',
|
||||
dateOnly: false,
|
||||
}),
|
||||
} satisfies {
|
||||
[key: string]: (...args: any[]) => OperatorConfig;
|
||||
};
|
||||
@@ -193,4 +200,9 @@ export const dataTablePowerSearchOperatorProcessorConfig = {
|
||||
enum_set_is_none_of: (_operator, searchValue: string[], value: string) =>
|
||||
!searchValue.some((item) => value === item),
|
||||
is_nullish: (_operator, _searchValue, value) => value == null,
|
||||
// See PowerSearchAbsoluteDateTerm
|
||||
newer_than_absolute_date: (_operator, searchValue: Date, value: any) => {
|
||||
const valueNormalized = dayjs(value);
|
||||
return valueNormalized.isAfter(searchValue);
|
||||
},
|
||||
} satisfies PowerSearchOperatorProcessorConfig;
|
||||
|
||||
Reference in New Issue
Block a user