Date and time
DatePicker, DateRangePicker, TimePicker, RelativeTime. They are copied into your app’s ui/ by qatjs add date: the code is yours to edit.
Example
Day 2026-10-23 at 14:30; placed 2026-10-01 to 2026-10-23; delivered
import { DatePicker, DateRangePicker, RelativeTime, TimePicker } from './ui/date/date.qx'
export default function Example() {
let day = state<string | undefined>('2026-10-23')
let from = state<string | undefined>('2026-10-01')
let to = state<string | undefined>('2026-10-23')
let time = state<string | undefined>('14:30')
return (
<div class="example-grid">
<DatePicker label="Delivery date" locale="en" min="2026-10-05" bind:value={day} />
<DateRangePicker label="Placed" locale="en" bind:start={from} bind:end={to} />
<TimePicker label="Window starts" step={15} bind:value={time} />
</div>
<p>
Day {day ?? 'none'} at {time ?? 'no time'}; placed {from ?? 'any'} to {to ?? 'any'}; delivered{' '}
<RelativeTime date="2026-10-23T11:12" locale="en" now={Date.parse('2026-10-23T14:12')} />
</p>
)
}
day statefrom stateto statetime state
Add it
shell1 line
npx qatjs add date
DatePicker
One date: typed in the locale's numeric format, or chosen from the calendar; `bind:value`. As a custom element: <ui-date-picker>.
DatePicker: props| Prop | Type | Attribute |
|---|
label | QatNode | property only |
help | QatNode | property only |
error | QatNode | property only |
required | boolean | yes |
disabled | boolean | yes |
size | 'sm' | 'md' | 'lg' | yes |
value | string | yes |
min | string | yes |
max | string | yes |
locale | string | yes |
invalidText | string | yes |
DatePicker: events| Event | Detail |
|---|
on:update:value | CustomEvent<string | undefined> |
DateRangePicker
Two dates: a button showing the range, a popup with presets and the calendar; `bind:start`, `bind:end`. As a custom element: <ui-date-range-picker>.
DateRangePicker: props| Prop | Type | Attribute |
|---|
label | string | yes |
start | string | yes |
end | string | yes |
presets | RangePreset[] | property only |
min | string | yes |
max | string | yes |
locale | string | yes |
placeholder | string | yes |
DateRangePicker: events| Event | Detail |
|---|
on:update:start | CustomEvent<string> |
on:update:end | CustomEvent<string> |
TimePicker
A time of day, 24 h: typed (14:30) or chosen from hour and minute columns; `bind:value`. As a custom element: <ui-time-picker>.
TimePicker: props| Prop | Type | Attribute |
|---|
label | QatNode | property only |
help | QatNode | property only |
error | QatNode | property only |
required | boolean | yes |
disabled | boolean | yes |
size | 'sm' | 'md' | 'lg' | yes |
value | string | yes |
step | number | yes |
invalidText | string | yes |
TimePicker: events| Event | Detail |
|---|
on:update:value | CustomEvent<string | undefined> |
RelativeTime
When something happened, in words ("3 hours ago"), the full date and time in its title. As a custom element: <ui-relative-time>.
RelativeTime: props| Prop | Type | Attribute |
|---|
date | string | yes |
locale | string | yes |
now | number | yes |
Keys
| Key | Does |
|---|
| ← → | a day |
| ↑ ↓ | a week |
| PageUp, PageDown | a month |
| Shift+PageUp, PageDown | a year |
| Home, End | the week’s ends |
| Enter, Space | choose |