Repository navigation
Datetime
Viames Marino edited this page Feb 26, 2026
·
2 revisions
Pair\Html\FormControls\Datetime renders date-time inputs (datetime-local or custom datetime).
datetimeFormat(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\TH:i:s. - Rendered input type is:
-
datetimewhenPost::usingCustomDatetimepicker()is true -
datetime-localotherwise
-
- Constructor may switch format from translation key
FORM_DATETIME_FORMATwhen custom picker is enabled. - With
Env::get('UTC_DATE'),DateTimevalues are converted to current user timezone before formatting.
$publishedAt = (new \Pair\Html\FormControls\Datetime('publishedAt'))
->min('2026-01-01T00:00:00')
->max('2026-12-31T23:59:59')
->value(new DateTime('now'))
->required();
echo $publishedAt->render();Custom format for custom picker:
$eventAt = (new \Pair\Html\FormControls\Datetime('eventAt'))
->datetimeFormat('d/m/Y H:i')
->value(new DateTime('2026-05-20 09:30:00'));See also: Date, Time, FormControl.
Home · Setup · Configuration
Build with Pair 4
- Generator
- Controllers and responses
- Read models
- ActiveRecord and queries
- Forms and validation
- PairUI.js and HTML fragments
APIs and authentication
- API guide and CRUD
- Middleware and rate limits
- Users, sessions, and ACL
- Passkeys and social login
- Native mobile setup
Integrate and operate
- Integrations
- Runtime extensions and adapter keys
- Cache and cache stores
- Logs and observability
- PWA and push
- Packages and distribution
- Upgrade to v4