-
Notifications
You must be signed in to change notification settings - Fork 2
Date
Viames Marino edited this page Feb 26, 2026
·
2 revisions
Pair\Html\FormControls\Date renders date inputs with formatting and min/max helpers.
dateFormat(string $format): selfmin(string|DateTime $minValue): selfmax(string|DateTime $maxValue): selfvalue(string|int|float|DateTime|null $value): staticrender(): string
- Default format is
Y-m-d. - If
Post::usingCustomDatepicker()and translation keyFORM_DATE_FORMATexists, constructor switches to translated format. -
min()andmax()accept string orDateTimeand outputY-m-dwhenDateTimeis used. - If
Env::get('UTC_DATE')is enabled and value isDateTime, value is converted to user timezone before formatting.
Native date input with explicit range:
$start = (new \Pair\Html\FormControls\Date('startDate'))
->min('2026-01-01')
->max('2026-12-31')
->value('2026-02-15')
->required();Using DateTime values:
$checkin = (new \Pair\Html\FormControls\Date('checkin'))
->value(new DateTime('2026-03-10 14:00:00'))
->min(new DateTime('2026-01-01'))
->max(new DateTime('2026-12-31'));For native <input type="date">, the rendered value should stay browser-compatible (YYYY-MM-DD).
See also: Datetime, Month, Time, FormControl.