Skip to main content

Date Time Picker

Ant Design

The Date Time Picker component lets users pick a date and a time together, such as when to schedule a meeting or a delivery slot.

Properties​

Property
Description
Expected Value
LabelText shown above the field, or beside it when Layout is horizontal.Text. Default: Date and time
ExtraHelp text shown under the field. A validation message replaces it while the value is invalid.Text
TooltipText shown when the user hovers over an info icon after the label.Text
Layoutvertical puts the label above the field; horizontal puts it at the left.vertical, horizontal. Default: vertical
ValueDate and time selected when the app loads, as YYYY-MM-DDTHH:mm:ss in local time. Reset field returns to this value.Text
FormatHow the date and time are written in the field, such as DD MMM YYYY HH:mm. It doesn't change the value's format. Leave it empty for YYYY-MM-DD and the time.Text
Use 12 hoursShows the time with AM and PM instead of the 24-hour clock.On or off. Default: Off
Minute stepGap between the minutes the user can pick, from 1 to 30, such as 15 for quarter hours.Number. Default: 5
Min dateEarliest date and time the user can pick, as YYYY-MM-DDTHH:mm:ss, or a date alone for the start of that day. An earlier value shows a validation error.Text
Max dateLatest date and time the user can pick, as YYYY-MM-DDTHH:mm:ss, or a date alone for the end of that day. A later value shows a validation error.Text
PlaceholderHint shown in the field while it is empty.Text. Default: Pick a date and time
Allow clearShows a button in the field that clears the date and time.On or off. Default: On
VariantStyle of the field box. outlined has a border, filled has a gray fill, borderless has neither, and underlined has only a bottom line.outlined, filled, borderless, underlined. Default: outlined
SizeHeight and text size of the field.small, middle, large. Default: middle

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off
Dynamic heightLets the component grow with its content in the running app instead of keeping a fixed height.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On changeTriggers when the selected date or time changes, by the user or an action.
On open changeTriggers when the picker opens or closes.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Set field valueChanges the date and time to the one given as YYYY-MM-DDTHH:mm:ss and fires On change. Text that isn't a date is ignored; empty text clears the field.components.datetimepicker1.setFieldValue("")
Reset fieldReturns the date and time to the Value property's value.components.datetimepicker1.resetFields()
ClearEmpties the field and fires On change.components.datetimepicker1.clear()
Set visibilityShows the component when true, hides it when false.components.datetimepicker1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.datetimepicker1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.datetimepicker1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
labelText shown above the field, or beside it when Layout is horizontal.{{components.datetimepicker1.label}}
extraHelp text shown under the field. A validation message replaces it while the value is invalid.{{components.datetimepicker1.extra}}
tooltipText shown when the user hovers over an info icon after the label.{{components.datetimepicker1.tooltip}}
layoutvertical puts the label above the field; horizontal puts it at the left.{{components.datetimepicker1.layout}}
valueDate and time selected when the app loads, as YYYY-MM-DDTHH:mm:ss in local time. Reset field returns to this value.{{components.datetimepicker1.value}}
formatHow the date and time are written in the field, such as DD MMM YYYY HH:mm. It doesn't change the value's format. Leave it empty for YYYY-MM-DD and the time.{{components.datetimepicker1.format}}
use12HoursShows the time with AM and PM instead of the 24-hour clock.{{components.datetimepicker1.use12Hours}}
minuteStepGap between the minutes the user can pick, from 1 to 30, such as 15 for quarter hours.{{components.datetimepicker1.minuteStep}}
minDateEarliest date and time the user can pick, as YYYY-MM-DDTHH:mm:ss, or a date alone for the start of that day. An earlier value shows a validation error.{{components.datetimepicker1.minDate}}
maxDateLatest date and time the user can pick, as YYYY-MM-DDTHH:mm:ss, or a date alone for the end of that day. A later value shows a validation error.{{components.datetimepicker1.maxDate}}
placeholderHint shown in the field while it is empty.{{components.datetimepicker1.placeholder}}
allowClearShows a button in the field that clears the date and time.{{components.datetimepicker1.allowClear}}
variantStyle of the field box. outlined has a border, filled has a gray fill, borderless has neither, and underlined has only a bottom line.{{components.datetimepicker1.variant}}
sizeHeight and text size of the field.{{components.datetimepicker1.size}}
selectedDateThe date part of the value, as YYYY-MM-DD.{{components.datetimepicker1.selectedDate}}
selectedTimeThe time part of the value, as HH:mm on the 24-hour clock.{{components.datetimepicker1.selectedTime}}
unixTimestampThe selected date and time as a Unix timestamp in milliseconds.{{components.datetimepicker1.unixTimestamp}}
isVisibleWhether the component is visible.{{components.datetimepicker1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.datetimepicker1.isLoading}}
isDisabledWhether the component is disabled.{{components.datetimepicker1.isDisabled}}

Styles​

Style
Default
Primary colorTheme: Brand primary
Text colorTheme: Primary text
Container backgroundTheme: Surface 1
Border colorTheme: Default border
Border radius—
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.