Skip to main content

Calendar

A month calendar that returns a normalized ISO YYYY-MM-DD date. Left/Right move by day and Up/Down by week (the vim preset binds h/l and k/j to the same moves), PageUp/PageDown change month, Home/End jump to the first/last day of the month, and Enter accepts. Pass default (a YYYY-MM-DD string) to open on a specific date; with none the calendar opens on today. The move keys are configurable through the key map, like every other widget.

$p->calendar('release', 'Release date')->default('2026-07-15');

Declare optional minDate, maxDate and weekStart to bound the range and set the first column of the week. Navigation is clamped to the range - the cursor never leaves it - and days outside it render dimmed. The bounds are enforced headlessly too - a --prompts or environment value outside the range is rejected - and are reflected in the JSON schema as min_date, max_date and week_start on the prompt.

use DrevOps\Tui\Config\Weekday;

$p->calendar('release', 'Release date')->minDate('2026-01-01')->maxDate('2026-12-31')->weekStart(Weekday::Sunday);
ANSINo ANSI
UnicodeCalendar: Unicode + ANSICalendar: Unicode + No ANSI
ASCIICalendar: ASCII + ANSICalendar: ASCII + No ANSI