React Admin Date Filter (Today, This Week, Last Week, This Month, Last Month)

Viewed 259

I am using React Admin. My data table has this column (id, date, name, email, address). Now I also add a sidebar to filter my data based on Today, This Week, Last Week, This Month, Last Month...

I also see the React Admin documentation.... how can I use this documentation code in my project

<FilterListItem
            label="This week"
            value={{
                last_seen_gte: startOfWeek(new Date()).toISOString(),
                last_seen_lte: undefined
            }}
        />

what is last_seen_gte and last_seen_lte ?? I have only column "Date" How can I use this column(Date) to filter???

1 Answers

Those are filter parameters implemented by the dataprovider example in the documentation, and would be parsed by the back end. in that example, you can filter dates in both directions: finding dates greater than or equal to some date, or less than or equal to some date. You can have multiple filters that work on the same "column" as long as it is supported by your back end and your dataprovider.

The important thing to note is that the filters are simply parameters that you pass to the dataprovider and then to the back end, and it is up to each project structure the data and provider accordingly.

Related