Date filters allow you to filter date data. The pages Provided Filters and Provided Simple Filters explains the parts of the date filter that are similar to the other provided filters. This page builds on that and explains some details that are specific to the date filter.
Date Selection Component
By default the grid will use the browser provided date picker for Chrome (as we think it's nice), but for all other browser it will provide a simple text field. To override this and provide a custom date picker see Date Component.
Date Filter Comparator
date filter will work by default. However if your date is in any other format you will have to provide
comparator callback to do the date comparisons.
comparator callback takes two parameters. The first parameter is a
parameter is the current value of the cell being evaluated. The callback must return:
- Any number < 0 if the cell value is less than the filter date
- 0 if the dates are the same
- Any number > 0 if the cell value is greater than the filter date
Below is an example of using a date filter with a comparator.
Once the date comparator callback is provided, then the Date Filter is able to perform all the comparison operations it needs eg 'Less Then', 'Greater Than' and 'Equals'.
Date Model vs Comparison Types