How do you use the date range component with a table?

I have a table that I would like to use to filter by date range. How do you filter by date by a specific column?

Thank you in advance!

Query Library

Hi there @graffiti,

You can use the table's default triggers, e.g.:

In this example my due_on column is filtered with two operators, one for the dateRange1.value.start and another for dateRange1.value.end

Would that work for you?

Hy @graffiti ,
There is another way to filter out dates within this date range like create a JS query for it in which you can filter out perfect data from your collection.
If you need query for it, I will give you example query for that.

1 Like

That would be amazing and much appreciated!
I haven't looked into being able to use JS yet, so am very curious to see how.
Thank you, @WidleStudioLLP .
What other information would you need from me?

I create a sample dynamic js sql query using date range selection for filter out data from database collection.

const selectDateStart = dateRange1.value.start;
const selectDateEnd = dateRange1.value.end;

let sqlQuery = `
 SELECT *
 FROM sample_users
`;

if (selectDateStart && selectDateEnd ) {
  sqlQuery += ` WHERE signup_date BETWEEN '${selectDateStart}' AND '${selectDateEnd}'`;
}

return sqlQuery;

And I used this return value in original sql query like:
image

If you need more help or more queries about it then feel free to ask.

1 Like