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

Pair framework: Month

Pair\Html\FormControls\Month renders <input type="month"> 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

  • min() and max() convert DateTime values to Y-m.
  • value(DateTime ...) converts to Y-m.
  • If Env::get('UTC_DATE') is enabled and value is DateTime, timezone is converted to current user timezone before formatting.

Examples

$billingMonth = (new \Pair\Html\FormControls\Month('billingMonth'))
    ->min('2026-01')
    ->max('2026-12')
    ->value('2026-02')
    ->required();

echo $billingMonth->render();

With DateTime:

$period = (new \Pair\Html\FormControls\Month('period'))
    ->value(new DateTime('2026-08-19 10:30:00'));

See also: Date, Datetime, FormControl.

Clone this wiki locally