Skip to content

Date Time Input

@astryxdesign/core v0.7.1 · DateTimeInput

Usage ​

DateTimeInput combines a date and a time. The value is YYYY-MM-DDTHH:MM, or null until both parts are set.

vue
<script setup lang="ts">
import { DateTimeInput } from '@astryx-vue/core/DateTimeInput'
import { shallowRef } from 'vue'

const meeting = shallowRef<string | null>(null)
</script>

<template>
  <DateTimeInput v-model="meeting" label="Meeting time" has-clear />
</template>

The date uses the date field. The time uses the same field as the time input. The two fields stay side by side and shrink with the row. They wrap only when the row is narrower than 16rem. bottom-sheet puts the date and the time in one bottom sheet, with tabs to move between them. Clear removes both parts. The date half can show two months and can start the week on a chosen day. While a change is saving, neither field can be edited.

Anatomy

ElementDescription
LabelText above the input describing what datetime is expected.
Segment rowThe unbordered layout row that holds the two bordered segments and wraps them when its container is narrow.
Date inputA typed date field with calendar popover on the fine-pointer Astryx surface, a real input type=date in native modes, or a read-only segment opening the Astryx touch sheet under presentation="adaptive-bottom-sheet" on a coarse pointer.
Calendar iconA button that opens the active date surface: the platform picker, Astryx calendar popover, or Astryx touch sheet.
Date pickerThe browser/OS picker in native modes, an Astryx month-grid popover on a fine pointer, or the Date panel of the Astryx bottom sheet on a coarse pointer with presentation="adaptive-bottom-sheet".
Time inputA real input type=time for the default minute-precision native mode, a text/combobox time field when seconds, custom increments, or preset options are requested, or a read-only segment opening accessible time wheels under presentation="adaptive-bottom-sheet" on a coarse pointer.
Clock iconThe time glyph shown as a leading identifier on the Astryx pointer field and as the picker affordance in native and touch-sheet time segments.
Time options popoverA list of preset times at the timeOptionInterval cadence. Setting the prop retains Astryx's text/combobox time field even when nativePicker otherwise selects native controls; the Astryx touch sheet uses wheels instead.
Time optionOne selectable preset time in the optional time-options popover.
Clear buttonA × button that resets the datetime value.
Status messageAn error, warning, or success message below the inputs.

Best practices ​

GuidelinePractice
DoTurn on hasClear when the appointment is optional.
Don'tUse it for a date with no time of day. DateInput is the smaller control.

Examples ​

Validation

This time slot is already booked
This falls outside business hours
Time confirmed

Error, warning, and success on a filled date and time.

Bottom sheet

Su
Mo
Tu
We
Th
Fr
Sa

One bottom sheet switches between the date and the time.