Skip to content

Date Picker ​

Easy Forms includes an advanced date picker component with support for single date selection, date ranges, and various constraints.

To use it, add a Date Picker field to your form. For example:

yaml
handle: date_field
field:
  type: date_picker
  display: 'Date Field'
  instructions: 'This field uses the "date_picker" fieldtype.'
The datepicker example that the code above creates.
The datepicker example that the code above creates.

The datepicker is built using Alpine.js and offers single date or range selection, along with full keyboard navigation support.

Additional config options ​

The following options are available in the "Easy Forms" section of the field configuration:

OptionTypeDescription
ModeButton groupSelect a single date or a date range. Ranges are stored as start and end dates.
Max rangeIntegerThe maximum number of days allowed when range mode is enabled.
Minimum date relative to todayIntegerSet to 0 to use today as the minimum date, or a positive/negative integer to add/subtract days from today.
Maximum date relative to todayIntegerSet to 0 to use today as the maximum date, or a positive/negative integer to add/subtract days from today.
Minimum dateDateThe specific minimum date allowed in the datepicker. (Ignored if "Minimum date relative to today" is set).
Maximum dateDateThe specific maximum date allowed in the datepicker. (Ignored if "Maximum date relative to today" is set).
Don't close after selectionToggleIf enabled, the datepicker will remain open after the user selects a date.

WARNING

The minimum, maximum and range limits apply in the browser. Add validation rules, such as after:today, to enforce them on the server.

In grids ​

Grid rows use Statamic's classic fieldtypes. Add a text field, set its input_type to date, and enable improved_field:

yaml
handle: date_of_birth
field:
  input_type: date
  type: text
  display: 'Date of Birth'
  improved_field: true