Date
A date picker field
Field options
| Name | Type | Default | Description |
|---|---|---|---|
| after | arrayorstring |
null
|
Optional text that will be shown after the input |
| autofocus | bool |
false
|
Sets the focus on this field when the form loads. Only the first field with this option gets focus |
| before | arrayorstring |
null
|
Optional text that will be shown before the input |
| calendar | bool |
true
|
Activate/deactivate the dropdown calendar |
| default | mixed |
null
|
Default value for the field, which will be used when a page/file/user is created |
| disabled | bool |
false
|
If true, the field is no longer editable |
| display | arrayorstring |
'YYYY-MM-DD'
|
Custom format (dayjs tokens: DD, MM, YYYY) that is used to display the field in the Panel |
| format | string |
no default value | Defines a custom format that is used when the field is saved |
| help | arrayorstring |
null
|
Optional help text below the field |
| icon | string |
'calendar'
|
Optional icon that will be shown at the end of the field |
| label | arrayorstring |
no default value | The field label can be set as string or associative array with translations |
| max | string |
null
|
Latest date, which can be selected/saved (Y-m-d) |
| min | string |
null
|
Earliest date, which can be selected/saved (Y-m-d) |
| required | bool |
false
|
If true, the field has to be filled in correctly to be saved. |
| step | arrayorstringorint |
no default value | Round to the nearest: sub-options for unit (day) and size (1) |
| time | arrayorbool |
false
|
Pass true or an array of time field options to show the time selector. |
| translate | bool |
true
|
Should the field be translatable? |
| validate | arrayorstring |
null
|
Additional validator rules for the value, e.g. email or ['minLength' => 3] |
| when | array |
null
|
Conditions when the field will be shown |
| width | string |
'1/1'
|
The width of the field in the field grid. Available widths: 1/1, 1/2, 1/3, 1/4, 2/3, 3/4 |
The date field generates a simple input with a nice date picker. It can be setup to display and store dates.

Example
fields:
published:
label: Published on
type: date
Display format
You can define the format of the date via the display option:
display: YYYY-MM-DD
display: DD.MM.YYYY
display: MM/DD/YYYY
| Token | Output | Description |
|---|---|---|
YY |
18 | Two-digit year |
YYYY |
2018 | Four-digit year |
M |
1-12 | Month |
MM |
01-12 | Month, 2-digits |
MMM |
Jan-Dec | Abbreviated month name |
MMMM |
January-December | Full month name |
D |
1-31 | Day of the month |
DD |
01-31 | Day of the month, 2-digits |
Text in square brackets is shown as it is, e.g. display: D. MMMM [in the year] YYYY. Empty fields show an example of the format as placeholder.
The field will parse any input by matching it to the display format. display: DD.MM.YYYY will match an input of 01.05.2015. It will also match partials or slight variations, e.g. 01.05., 1.5.2015, 01.05.15. The base for partials will be the current year, month... Month names and their abbreviations are recognized in English and in the current Panel language. If the input can't be read, the field keeps it and marks it as invalid.
Step
The step option allows you to define intervals of valid values. Any input to the field gets rounded to the nearest interval step.
step:
unit: day
size: 2
# only unit, size will default to `1`
step: month
# only size, unit will default to `day`
step: 2
While this is more useful in the time field (e.g. rounding to 5 minute steps), in the context of the date field this can be used, e.g. to let users only select month and year:
myMonth:
type: date
display: MMM YYYY
step: month
Keep in mind that the full date is still stored in the content file, e.g. 2020-05-01. You need to adapt your templates as well to only show month and year, e.g. $page->myMonth()->toDate('F Y').
Time settings
To enable time input, set the time option to true:
fields:
published:
label: Published on
type: date
time: true
You can also pass all time field options to the time input:
fields:
published:
label: Published on
type: date
time:
step: 1 # 1 minute steps
If you want to define a display option, define it for date and time input separately:
fields:
published:
label: Published on
type: date
display: MM/DD/YYYY
time:
display: h.mm a
Default value
The default value can either be set to a specific date (e.g. 2020-05-01) or as today.
fields:
published:
label: Published on
type: date
default: today
With the time option enabled, you can set a specific date and time (e.g. 2022-07-01 12:05) or use now for the current date and time:
fields:
published:
label: Published on
type: date
time: true
default: now
Or using a combination of the current date but a specific time:
fields:
published:
label: Published on
type: date
time: true
default: today 20:15
You can even do date/or date-time calculations:
fields:
published:
label: Published on
type: date
time: true
default: now + 1 day
This also works for today. Other relative settings like tomorrow or yesterday will also work, btw.
How to use in templates/snippets
The field stores its value in a standardized format in the content file: Y-m-d for only dates, Y-m-d H:i:s for date and time combined. To convert the value to a date string or timestamp, use the toDate() method.
Without a date format, the toDate() field method renders a UNIX timestamp:
<?= $page->published()->toDate() ?>
Use a date format to render the date in your desired output format:
<?= $page->published()->toDate('Y-m-d') ?>
If you have set the date handler to strftime in your config, use the corresponding format syntax:
<?= $page->published()->toDate('%Y-%m-%d') ?>
Update programmatically
To change the field value from PHP, pass a date string, a DateTime object or a UNIX timestamp to $page->update():
$page->update([
'published' => '2026-10-01'
]);
Kirby stores the date in the format of the field. If the field includes a time, add it to the string (e.g. '2026-10-01 14:30'). The time is rounded to the field's step.