Skip to main content
io.input.datetime() requests a point in time and returns it as a luxon DateTime. Provided by the @awaitio/input-datetime package.
A Trial ends at field with a date and time, and the hint Time zone: Europe/Prague under it
The person picks the date and time in their browser’s time zone, which is shown under the field (Time zone: Europe/Prague). The value is sent to the server in UTC, so the handler gets the same instant whatever time zone the person is in.

Install

Setup

Register it under the key you want in io, see Input components:
app.ts

Usage

Props

defaultValue, min and max take a luxon DateTime, a JavaScript Date or an ISO 8601 string. An impossible date such as 2026-02-30 throws when the io call is made.

Optional

The field is required. Chain .optional() to let it stay empty; the handler then gets DateTime | undefined, see Optional fields.

Returns

A luxon DateTime in the UTC zone. Convert it with .setZone(...) when you need local time, or .toISO() to store it.

Built-in validation

The field is always required. The input works in whole minutes, so min and max are compared at minute precision: min: DateTime.now() still accepts the current minute. The server checks every answer: <min> and <max> are printed in UTC.

Custom validation

Chain .validate() for a check of your own. It runs on the server after the checks above, gets the value the handler would get and returns a message to show under the field, or nothing when the value is fine; see Custom validation.