Skip to main content
io.input.date() requests a calendar date, without a time, and returns it as a luxon DateTime. Provided by the @awaitio/input-date package.
A Date field with a picked date, and help text under it
The value is a day, not an instant, so no time zone is involved: the date the person picks is the date the handler gets.

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 (its own zone’s day), a JavaScript Date (its day in UTC) or a 'YYYY-MM-DD' 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 at the start of the picked day in the UTC zone. Use .toISODate() to store it as 'YYYY-MM-DD'.

Built-in validation

The browser checks the date before sending, and the server checks every answer again: <min> and <max> are printed as YYYY-MM-DD.

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.