filters

How to filter the created at field with between operator
3 Replies
kapa.ai
kapa.ai14mo ago
Hi @Malathi. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To filter the createdAt field using the between operator in refine, you can create a CrudFilters array with the necessary filter objects. Here's an example of how to do this:
const filters: CrudFilters = [
{
field: "createdAt",
operator: "between",
value: [startDate, endDate], // Replace startDate and endDate with the actual values
},
];
const filters: CrudFilters = [
{
field: "createdAt",
operator: "between",
value: [startDate, endDate], // Replace startDate and endDate with the actual values
},
];
In this example, replace startDate and endDate with the actual values you want to filter between. The between operator expects an array with two values, representing the start and end of the range. You can use this filters array when calling a hook like useTable, useSimpleList, or useExport to apply the filter to your data. For more information on CrudFilters, refer to the Interface References (https://refine.dev/docs/api-reference/core/interfaceReferences#crudfilters) in the refine documentation. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai14mo ago
<@1115895621673558029> kapa.ai is still learning and improving, please let us how it did by reacting below
deep-jade
deep-jade14mo ago
You can send your filters like @kapa.ai said. But your API must support this.