How can i filter DateField with range in react admin - react-admin

I want to filter dateField with range, for example i have this field:
<DateField source="starts_at" showTime/>
starts_at = 2021-10-24 12:16:31.843+03
and i want to filter this field with range, how can i do it?

Related

Filtering date in Redshift by date stored as a string

The below works as a filter. But I don't understand why.
We are taking column "valid_from" (with format 2019-06-20 00:00:00.0) and then converting it to a string and filtering by this (so we are filtering by a string). However, valid_from is in date/time format and not string so why does filtering by a string give results?
SELECT * from capacity_planning
WHERE TO_CHAR(valid_from, 'DD/MM/YYYY') = '23/06/2019'
Similarly, I've seen filters like:
where event_date between '2018-01-01' and '2018-01-31';
But again, in such cases the dates being filtered for are strings?
this should work (just tried it )
SELECT * from capacity_planning
where event_date >= '2018-01-31' and event_date < '2018-01-01'
make sure you consider other possible causes

How to select between date range on a materialize v1 date picker

I want to use materialize date picker to set select date range from currently to other date. Example: I have 2 input.I click first input select tomorrow date then I click second input it will disable before date. So how do I do? and I always research I saw they use: $('.datepicker').pickadate(); why using pickadate? and in Materialize document they use datepicker.

PostgreSQL date range query

I have a PSQL database that has fields for "start_time" and "end_time" in a table.
These get imported from a json file as string to a text field in the database. The string has the following format: yyyy-mm-dd hh:mm:ss
I want to do a query to give all id's of a table in the database that are within a given date range.
To do this I can do one of two things. Either I can query for a list of start and end times given a date range, and with the return from that query do a separate query for the actual data I am looking to get with WHERE start_time = ANY ('{list of dates go here}')
The other option is to figure out how to change the format of the row to something that is comparable. Something like WHERE start_time > beginning of date range AND end_time > end of date range if the fields are not text fields.
The date range is going to come from a date time picker from a website.
This might be a duplicate post but after hours of searching for a solution to either of those nothing has come up. So anything in the right direction is helpful.
Thanks
PostgreSQL should go easy on you in this case. Simply cast the string to timestamp and to the comparison.
This should work out of the box:
WHERE start_time::timestamp > '2016-01-01' AND end_time::timestamp < '2016-12-31'

BIRT Data Set Query for greater than date range from string

SELECT CRM.CUSTOMERS WITH LAST.INVOICE.DATE > 12/31/2010
The LAST.INVOICE.DATE column is coming in as a string, so I made a computed column that converted it into a date, which worked fine. Based on that, I tried a fresh query pulling from the new re-formatted DATE column which looked like this:
SELECT CRM.CUSTOMERS WITH DATE > 2010-12-31
I also tried:
SELECT CRM.CUSTOMERS WITH DATE > "2010-12-31"
Both previews are blank.
I also tried to filter the computed DATE column for > 2010-12-31 and the preview generates everything in the column regardless of date.
I'm sure I'm being an idiot, any help is appreciated.
Before
SELECT CRM.CUSTOMERS WITH DATE > "2010-12-31"
After
SELECT CRM.CUSTOMERS WITH DATE > to_date("2010-12-31", 'MM-DD-YYYY')
You could try using single quotes
SELECT CRM.CUSTOMERS WITH DATE > '2010-12-31'
If that doesn't work you need to make sure you have the correct date format.

Filtering data using string YYYYMMDD date in query

Below WHERE clause is used to filter the data using BETWEEN keyword.
WHERE dateCol BETWEEN date1 AND date2
But the table contains column of data type CHARACTER which stores date like 20130407 (YYYYMMDD). I can't change the data type of the column because of privilege and it is already present and in use. Now I need to filter the data between two dates like between 20130701 and 20130801. I can't use BETWEEN because that column is not of DATE type. Might be usage of IN criteria is alternative, but it makes query very lengthy and not dynamic. Can someone please suggest how to do filter this between two dates?
Just use the same format for the comparisons:
WHERE dateCol BETWEEN '20130701' and '20130801'
I do suspect, however, that you really mean:
WHERE dateCol >= '20130701' and
dateCol < '20130801'
To get everything in July without the first of August.