Date Picker
Basic Usage
The DatePicker field renders a calendar-based date picker. By default, it picks a single date:
use InertiaUI\Forms\Fields\DatePicker;
DatePicker::make('birthday');Modes
The date picker supports five selection modes, and it uses single-date mode by default. Calling a mode method also adds the matching validation rule.
Single Date
Single-date mode picks one date. To add a date validation rule explicitly, call the single method:
DatePicker::make('birthday')->single();Date Range
The range method picks a start date and an end date. It adds an array validation rule:
DatePicker::make('vacation')->range();Multiple Dates
The multiple method picks several individual dates. It adds an array validation rule:
DatePicker::make('holidays')->multiple();Month Picker
The month method picks a month and a year. It validates the value against date_format:Y-m:
DatePicker::make('billing_month')->month();The month picker submits its value as YYYY-MM, such as 2026-07.
Year Picker
The year method picks a year. It validates the value as an integer between 1900 and 2100:
DatePicker::make('graduation_year')->year();The year picker submits its value as YYYY, such as 2026.
Date and Time
The withTime method adds time selection next to the date. It changes the value format to include hours and minutes:
DatePicker::make('starts_at')->withTime();
DatePicker::make('starts_at_24')
->withTime()
->use24HourTime();Time controls are available in single and range modes. They aren't rendered for multiple, month, or year values, and combining withTime with one of those modes in PHP throws an InvalidArgumentException.
24-Hour Format
To use 24-hour time instead of 12-hour time with AM and PM, call the use24HourTime method:
DatePicker::make('starts_at')
->withTime()
->use24HourTime();Timezone
The timezone method displays UTC database timestamps in the user's local timezone. Without it, date-time values are submitted and stored exactly as entered:
DatePicker::make('webinar_starts_at')
->withTime()
->use24HourTime()
->timezone('Europe/Amsterdam');For example, a database value of 2026-07-15 12:00:00 UTC renders as Jul 15, 2026 14:00 in Amsterdam. Submitting 2026-07-15 14:00 converts the value back to 2026-07-15 12:00 UTC for storage.
Call the validated method before you store the form data. It returns the timezone-adjusted UTC value after the field transformations have run. The validate method returns the same transformed data. For Laravel's raw validated payload, call validator()->validate().
The conversion only applies when withTime is enabled in single or range mode. Single values are converted as strings, and range values are converted item by item. Multiple, month, and year values aren't converted. The conversion uses the configured valueFormat.
Selectable Dates
These methods limit which dates the user may pick and offer quick choices. Backend validation enforces the minimum, maximum, and disabled dates too.
Min and Max Date
To limit the selectable dates, you may use the minDate and maxDate methods. For scalar date submissions, they add the after_or_equal and before_or_equal validation rules. For range and multiple values, every submitted date is validated against the same bounds:
DatePicker::make('appointment')
->minDate('2025-01-01')
->maxDate('2025-12-31');You may also compute the bound from today's date:
DatePicker::make('start_date')
->minDate(now()->format('Y-m-d'));Disabled Dates
The disabledDates method disables specific dates in the calendar and rejects those dates during backend validation:
DatePicker::make('appointment')->disabledDates([
'2025-12-25',
'2025-12-26',
'2026-01-01',
]);For range and multiple values, each submitted date is checked.
Presets
The presets method adds quick-select buttons for common values. Presets work in every mode, but each preset's value must use the same shape that the mode submits:
| Mode | Preset value shape |
|---|---|
single() | Date string, such as '2026-07-19'. |
single()->withTime() | Date-time string, such as '2026-07-19 09:00'. |
range() | Exactly two strings: [start, end]. |
range()->withTime() | Exactly two date-time strings: [start, end]. |
multiple() | An array of date strings. Multiple-date arrays are supported only for multiple mode. |
month() | Month string, such as '2026-07'. |
year() | Year string, such as '2026'. |
The frontend applies preset values as they are, so format each value to match the value the mode submits:
DatePicker::make('period')
->range()
->presets([
['label' => 'Launch week', 'value' => ['2026-07-13', '2026-07-17']],
['label' => 'Conference', 'value' => ['2026-08-10', '2026-08-14']],
['label' => 'Review sprint', 'value' => ['2026-09-07', '2026-09-18']],
]);Multiple mode accepts arrays with more than two dates:
DatePicker::make('holidays')
->multiple()
->presets([
['label' => 'Office closure', 'value' => ['2026-12-24', '2026-12-25', '2026-12-31']],
]);Display and Value Format
To customize how the date is shown to the user and how it's submitted, you may use the displayFormat and valueFormat methods:
DatePicker::make('birthday')
->displayFormat('DD/MM/YYYY') // What the user sees
->valueFormat('YYYY-MM-DD'); // What gets submittedBoth methods accept the following tokens:
| Token | Description | Example |
|---|---|---|
YYYY | 4-digit year | 2025 |
YY | 2-digit year | 25 |
MMMM | Full month | January |
MM | 2-digit month | 01-12 |
M | Month without padding | 1-12 |
DD | 2-digit day | 01-31 |
HH | 24-hour hour | 00-23 |
mm | Minutes | 00-59 |
ss | Seconds | 00-59 |
MMM | Abbreviated month | Jan, Feb |
D | Day without padding | 1-31 |
The default display format is MMM D, YYYY. The default value format is YYYY-MM-DD, and YYYY-MM-DD HH:mm once withTime is enabled. The withTime method resets the value format to one of these defaults, so call valueFormat after withTime.
The displayFormat method controls the visible date text for the day-based modes: single, range, and multiple. The valueFormat method controls the submitted date strings for those modes, including the date-time string when withTime is enabled. Neither method changes the fixed submission shape of month values, which is YYYY-MM, or year values, which is YYYY.
Existing values, presets, standalone values, and submitted values must all match the configured value format. Date constraints, openTo, markers, and highlighted dates stay ISO-style date strings, such as 2026-04-16.
Picker Options
These methods change how the trigger and the calendar look and behave.
Initial Open Date
By default, an empty picker opens on today's month. To open it on a specific month or year instead, use the openTo method. A picker with an existing value shows that value first:
DatePicker::make('release_date')
->openTo('2027-03-01');Placeholder
The placeholder method sets the text shown before a value is selected:
DatePicker::make('birthday')->placeholder('Choose a birthday');The default placeholder is Select date in every mode.
Clearable
The clearable method lets the user clear the selected date:
DatePicker::make('deadline')->clearable();Number of Months
The numberOfMonths method shows several months side by side, which helps with range selection:
DatePicker::make('vacation')
->range()
->numberOfMonths(2);First Day of Week
The firstDayOfWeek method sets the day the week starts on. 0 is Sunday, 1 is Monday, and so on. The week starts on Sunday by default:
DatePicker::make('date')->firstDayOfWeek(1); // MondayDirect components receive this setting as the weekStartsOn prop.
Inline
The inline method keeps the date grid visible on the page instead of opening it from a dropdown. Use it for booking, scheduling, and availability interfaces:
DatePicker::make('date')->inline();Week Numbers
The showWeekNumbers method displays ISO week numbers in the calendar:
DatePicker::make('date')->showWeekNumbers();Markers
The markers method adds colored dots on specific dates to indicate events or deadlines:
DatePicker::make('date')->markers([
['date' => '2025-06-15', 'color' => 'blue', 'tooltip' => 'Team meeting'],
['date' => '2025-06-20', 'color' => 'red', 'tooltip' => 'Deadline'],
['date' => '2025-07-01', 'color' => 'green'],
]);Each marker accepts the following keys:
| Key | Required | Description |
|---|---|---|
date | Yes | The date string (e.g., 2025-06-15) |
color | No | Dot color (e.g., blue, red, green) |
tooltip | No | Tooltip text on hover |
Highlighted Dates
The highlightedDates method gives specific dates a background color:
DatePicker::make('date')->highlightedDates([
'2025-06-15',
'2025-06-20',
'2025-07-01',
]);Combining Options
The following field combines several of the options above:
DatePicker::make('event_date')
->range()
->withTime()
->use24HourTime()
->timezone('Europe/London')
->minDate('2025-01-01')
->maxDate('2026-12-31')
->openTo('2026-06-01')
->numberOfMonths(2)
->firstDayOfWeek(1)
->showWeekNumbers()
->clearable()
->placeholder('Select a date range')
->required()
->precognitive();Shared Field APIs
The date picker methods work together with the shared field APIs:
- Form Class covers labels, help text, and placeholders.
- Model Binding covers the
defaultmethod. - Validation covers rules, required fields, and precognition.
- Styling covers classes and presentation helpers.
- Conditional Visibility
- Authorization
Using the Component Directly
Each package exports the DatePicker component from its components subpath. You may use it for standalone date selection or while rendering forms manually:
<script setup lang="ts">
import { DatePicker } from '@inertiaui/form-vue/components'
import { ref } from 'vue'
const vacation = ref<string | string[] | [string, string] | null>(null)
const presets = [
{ label: 'Next week', value: ['2026-07-27 09:00', '2026-07-31 17:00'] },
{ label: 'Conference', value: ['2026-08-10 09:00', '2026-08-14 17:00'] },
]
const disabledDates = ['2026-08-03', '2026-08-04']
const markers = [{ date: '2026-08-10', color: 'blue', tooltip: 'Conference begins' }]
const highlightedDates = ['2026-08-14']
const trackFocus = () => {}
</script>
<template>
<DatePicker
v-model="vacation"
id="vacation"
name="vacation"
label="Vacation"
help="Choose the travel window."
placeholder="Select travel dates"
mode="range"
with-time
:use-24-hour-time="true"
min-date="2026-07-01"
max-date="2026-08-31"
:disabled-dates="disabledDates"
:presets="presets"
display-format="MMM D, YYYY"
value-format="YYYY-MM-DD HH:mm"
clearable
:number-of-months="2"
:week-starts-on="1"
show-week-numbers
open-to="2026-08-01"
:markers="markers"
:highlighted-dates="highlightedDates"
data-testid="vacation-picker"
@focus="trackFocus"
/>
</template>import { useState } from 'react'
import { DatePicker } from '@inertiaui/form-react/components'
import type { DatePickerProps } from '@inertiaui/form-react/components'
const presets = [
{ label: 'Next week', value: ['2026-07-27 09:00', '2026-07-31 17:00'] },
{ label: 'Conference', value: ['2026-08-10 09:00', '2026-08-14 17:00'] },
]
const disabledDates = ['2026-08-03', '2026-08-04']
const markers = [{ date: '2026-08-10', color: 'blue', tooltip: 'Conference begins' }]
const highlightedDates = ['2026-08-14']
export default function VacationPicker() {
const [vacation, setVacation] = useState<DatePickerProps['value']>(null)
const trackFocus = () => {}
return (
<DatePicker
value={vacation}
onValueChange={setVacation}
id="vacation"
name="vacation"
label="Vacation"
help="Choose the travel window."
placeholder="Select travel dates"
mode="range"
withTime
use24HourTime
minDate="2026-07-01"
maxDate="2026-08-31"
disabledDates={disabledDates}
presets={presets}
displayFormat="MMM D, YYYY"
valueFormat="YYYY-MM-DD HH:mm"
clearable
numberOfMonths={2}
weekStartsOn={1}
showWeekNumbers
openTo="2026-08-01"
markers={markers}
highlightedDates={highlightedDates}
data-testid="vacation-picker"
onFocus={trackFocus}
/>
)
}Native attributes and listeners target the underlying trigger element. See Native Attributes And Events.