BalanceReckon Design System
Forms

DateInput

A text-based input for capturing a date the user types.

import { DateInput, formatDateObj } from '@balance-web/date-input';
Loading demo…

NOTE: all date components expect their value to be an ISO 8601 date string (without the time signature), which follows the format yyyy-mm-dd

Usage

Loading demo…

The ISODate type

value/onChange don't use a plain string — ISODate is a branded type (string & { ___ISODateString: true }), so a value you haven't gotten back from a date component's own onChange (or explicitly cast) won't type-check as one. This is deliberate: it stops an arbitrary string being passed where a validated yyyy-mm-dd date is expected. If you need to seed a default value, cast the literal: '2024-01-01' as ISODate.

ISODateRange/InternalDateRange are the equivalent shape for a { start, end } date range, used by range-capable components like DatePicker.

formatDateObj(date: Date) formats a native JS Date into this package's display format (dd/mm/yyyy) — useful if you're building something adjacent to DateInput that needs to render dates the same way.

On this page