Hello,
I'm working on creating a custom component for a date range filter. On our applilcation, we need filters for "Today, This Week, Upcoming, Previous, and All," which I have specifically set up in the facet configuration as such:
"start_date_filter": {
type: "range",
ranges: [
{
from: moment().startOf("day").format('YYYY-MM-DD'),
to: moment().endOf("day").format('YYYY-MM-DD'),
name: "Today",
},
...
],
}
In addition to this, I am creating a custom date range filter that uses Material's date picker input.
<DatePicker
defaultValue={moment().startOf("day")}
label="FROM"
onChange={(newValue) => {
setFilter(
"start_date-filter",
{
from: from.format('YYYY-MM-DD'),
name: from.format('YYYY-MM-DD')
},
"any")
}}
/>
It successfully sends a request to the instance formatted as such:
filters: [{
field: "start_date_filter",
values: [{from: '2025-02-20', name: '2025-02-20'}]
}]
(I've also tried it without the 'name' field; no dice.)
However, my application doesn't filter from that date properly. I noticed that the only filter will accept are the named filters from the preset ranges, such as:
{field: "start_date_filter", values: ['Today']}
Is there a way that I can both create the preset ranges and allow for the custom range set by the user? Do I need to set up some kind of function that adds the facet to the config or something?