Date Range

A combination select and input field to select two dates from a popup or directly enter them as text. It supports start and end values, and minimum and maximum dates.

Date Range can display values using different time zones and adjust for the time difference. For example, a value of January 1, 2021 at 11:00 PM (UTC) can be displayed as January 2, 2021 at 8:00 AM (UTC+9:00).

Properties

Available properties for Date Range with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read information about components.

NameTypeDescriptionvalue{ start: string; end: string; }

The current value.

dateFormatstring

The displayed date format.

disabledboolean

Whether user input, interaction, or selection is disabled.

endPlaceholderstring

The text to display in the input field when the end date is empty.

formDataKeystring

The key used by a Form component to assign default values to input fields using form.initialData, and to construct the form.data property.

formattedValuestring

The selected value in the specified format.

hiddenboolean

Whether the component is visible.

hideValidationMessageboolean

Whether to hide the validation message if the invalid is true.

iconAfterIconKey

The icon to display after the primary content.

iconBeforeIconKey

The icon to display before the primary content.

invalidboolean

Whether the current value has failed any validation rules.

labelstring

The text to display as a label for the input field.

labelAlign'left' | 'right'

The horizontal alignment of the label.

labelCaptionstring

The additional text to display with the label.

labelPosition'left' | 'top'

The position of the label relative to the input field.

labelWidthnumber

The label width, in the unit specified in labelWidthUnit.

labelWidthUnit'%' | 'px' | 'col'

The specified units for labelWidth.

labelWrapboolean

Whether the label can wrap to multiple lines.

loadingboolean

Whether to display a loading indicator.

maintainSpaceWhenHiddenboolean

Whether the component takes up space on the canvas if hidden is true.

marginstring

The amount of margin to render outside of the component.

maxDatestring

The latest date to allow.

minDatestring

The earliest date to allow.

readOnlyboolean

Whether the value is read only and cannot be modified.

requiredboolean

Whether the input is required for validation.

showClearboolean

Whether to display a button to clear the current value of the input field.

showInEditorboolean

Whether the component remains visible in the editor if hidden is true.

startPlaceholderstring

The text to display in the input field if the start date is empty.

textAfterstring

The text to display after the primary content.

textBeforestring

The text to display before the primary content.

textBetweenstring

The text to display between the two input fields.

tooltipTextstring

The text to display in a tooltip on hover or focus.

validationMessagestring

The validation message to display if the input is invalid.

Events

Events are triggered by user interactions with Date Range. Use event handling to trigger queries or other actions in response to events.

NameDescriptionSubmit

A user submits the current value.

Change

A user changes the current value.

Focus

A user selects the input field.

Blur

A user deselects the input field.

Methods

Methods for interacting with Date Range. You can write JavaScript almost anywhere in Retool and use methods to manipulate data or components.

NameDescriptionsetValue(value: any)

Set the current date range values.

clearValue()

Clear the current value.

scrollIntoView(options: any)

Scrolls the canvas or parent container so that the selected component appears in the visible area.

validate()

Validates the value of the input field.

clearValidation()

Clear the validation message from the input field.

setHidden(hidden: boolean)

Set the hidden value to toggle whether the component is visible. Defaults to true without a parameter.

setDisabled(disabled: boolean)

Set the disabled value to toggle whether the input field is disabled. Defaults to true without a parameter.

resetValue()

Reset to the default value.

focus()

Set focus on the input field.

setStartValue(startValue: any)

Specify a start value of the date range

setEndValue(endValue: any)

Specify an end value of the date range

setRange(range: any)

Set the current date range values.

Related components