Hi @Simon_Chen ,
This is possible but you will have to override each of the operator for the filter function.
Here is a snippet to show you how to override one operator:
houses
.addField("dateOfNow", {
columnType: "Date",
dependencies: ["id"],
getValues: (records) => records.map(() => new Date()),
})
.replaceFieldOperator("dateOfNow", "Equal", (value) => {
return {
aggregator: "And",
conditions: [
{
field: "example",
operator: "Equal",
value: new Date(value),
},
],
};
});
Here is a second snippet with all the operators:
const basicOperators = ["Blank", "Equal", "Missing", "NotEqual", "Present"];
const dateOperators = [
"Today",
"Yesterday",
"PreviousXDaysToDate",
"PreviousWeek",
"PreviousWeekToDate",
"PreviousMonth",
"PreviousMonthToDate",
"PreviousQuarter",
"PreviousQuarterToDate",
"PreviousYear",
"PreviousYearToDate",
"Past",
"Future",
"PreviousXDays",
"Before",
"After",
"BeforeXHoursAgo",
"AfterXHoursAgo",
];
const timeOperators = ["LessThan", "GreaterThan"];
[...basicOperators, ...timeOperators, ...dateOperators].forEach(
(operator) => {
houses.replaceFieldOperator("dateOfNow", operator, (value) => {});
}
);
You will have to implement the filtering process for each operator that you want to use.
Best regards,
Shohan