Skip to content

Date Filter

DateFilter renders a date picker in the UI and automatically applies the correct timestamp querying logic to your database.

By default, the DateFilter acts as a single-date selector. It comes with three default operators:

  • equals (Exact date)
  • < (Before this date)
  • > (After this date)
use Kinetics\Filters\DateFilter;
DateFilter::make('created_at')

Instead of picking a single date, you can configure the filter to accept a Start Date and an End Date.

To enable this, call the range() method.

use Kinetics\Filters\DateFilter;
DateFilter::make('created_at')->range()

When range() is enabled:

  1. The frontend UI transforms into a dual date-picker (start and end).
  2. The available operator is forcefully set to between.
  3. The SQL query generated will use the WHERE ... BETWEEN logic.
MethodDescription
make(string $key)Creates a new filter instance.
label(string $label)Sets the filter label.
column(string $column)Specifies the database column name if different from the key.
relation(string $relation, string $relationKey)Explicitly sets the relationship to query.
operators(array $operators)Overrides the allowed operators for this filter.
range(bool $condition = true)Sets this filter to act purely as a date range filter (from-to).