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 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:
| Option | Type | Description |
|---|---|---|
| Mode | Button group | Select a single date or a date range. Ranges are stored as start and end dates. |
| Max range | Integer | The maximum number of days allowed when range mode is enabled. |
| Minimum date relative to today | Integer | Set to 0 to use today as the minimum date, or a positive/negative integer to add/subtract days from today. |
| Maximum date relative to today | Integer | Set to 0 to use today as the maximum date, or a positive/negative integer to add/subtract days from today. |
| Minimum date | Date | The specific minimum date allowed in the datepicker. (Ignored if "Minimum date relative to today" is set). |
| Maximum date | Date | The specific maximum date allowed in the datepicker. (Ignored if "Maximum date relative to today" is set). |
| Don't close after selection | Toggle | If 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