Skip to content
Viames Marino edited this page Feb 26, 2026 · 2 revisions

Pair framework: Time

Pair\Html\FormControls\Time renders <input type="time"> with min/max helpers.

Methods

  • min(string|DateTime $minValue): self
  • max(string|DateTime $maxValue): self
  • value(string|int|float|DateTime|null $value): static
  • render(): string

Behavior

  • String values are stored as-is (typically HH:MM or HH:MM:SS).
  • value(DateTime ...) formats to H:i.
  • If Env::get('UTC_DATE') is enabled and value is DateTime, timezone is converted to current user timezone.

Example

$meeting = (new \Pair\Html\FormControls\Time('meetingTime'))
    ->min('09:00')
    ->max('18:00')
    ->value('10:30')
    ->required();

echo $meeting->render();

Using DateTime:

$slot = (new \Pair\Html\FormControls\Time('slot'))
    ->value(new DateTime('2026-02-26 14:45:00'));

Notes

For min() and max(), when passing a DateTime object, current implementation formats it as Y-m-d instead of H:i. For predictable output, prefer passing string time values.

See also: Date, Datetime, FormControl.

Clone this wiki locally