Skip to main content

DatePicker (ALPHA)

Alpha feature: invite only

Responsive Widgets are in alpha and available by invitation only on Business and Enterprise plans. Behavior and properties may change. To request access, open a support ticket and name the feature Responsive Widgets (ALPHA).

The DatePicker widget lets users pick a date from a calendar or type it in. You can also let users pick a time, down to the second. Use it for dates such as a due date, a booking date, or a date of birth. To pick a start and end date, use the DateRangePicker widget.

DatePicker widget in a Responsive app
DatePicker widget

Widget type: WDS_DATEPICKER_WIDGET

Content properties​

These properties appear in the Content tab of the property pane.

Type​

Data type string​

Sets the kind of input. Choosing another type changes the widget into the matching input widget. You cannot bind this property. Options: Single-line text, Multi-line text, Number, Password, Email, Phone number, Currency, Date. Default: Date.

Data​

Date format string​

Sets the format of formattedDate. Pick a format from the list, or switch to JS to enter a moment.js format string. Default: YYYY-MM-DD HH:mm.

The list offers these formats: ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ), LLL, LL, YYYY-MM-DD HH:mm, YYYY-MM-DDTHH:mm:ss, YYYY-MM-DD hh:mm:ss A, DD/MM/YYYY HH:mm, D MMMM, YYYY, H:mm A D MMMM, YYYY, YYYY-MM-DD, MM-DD-YYYY, DD-MM-YYYY, MM/DD/YYYY, DD/MM/YYYY, DD/MM/YY, and MM/DD/YY.

Default Date string​

Sets the date shown when the widget loads. Pick a date, or switch to JS to bind an ISO date string. If you change this value, the widget's date updates to match. Default: empty.

Example:

{{moment().format("YYYY-MM-DD")}}

Time Precision string​

Sets how precise the time is, or hides the time picker. Options:

  • Day: date only, no time picker.
  • Hour
  • Minute
  • Second

Default: Day.

First day of week string​

Sets the first day of the week in the calendar. Options: Sunday to Saturday. When you bind it, use one of sun, mon, tue, wed, thu, fri, or sat. Default: Sunday.

Label​

Text string​

Sets the label shown above the date input. Default: Label.

Validations​

Required boolean​

Makes picking a date mandatory. When on and no date is set, the widget is invalid and shows the message "Please select a valid date" after the user interacts with it. Default: off.

Minimum Date string​

Sets the earliest date users can pick. A selected date outside the allowed range makes the widget invalid.

Maximum Date string​

Sets the latest date users can pick. A selected date outside the allowed range makes the widget invalid.

General​

Tooltip string​

Shows help text or details next to the label.

Visible boolean​

Controls whether the widget is visible when the app runs. Default: on.

Disabled boolean​

Stops users from changing the date. Default: off.

Animate loading boolean​

Shows a loading animation while the widget's data loads. Default: on.

Style properties​

These properties appear in the Style tab of the property pane.

Custom styling​

These settings are in the Custom styling section, at the end of the Style tab. An empty setting uses the theme value. For theme colors, dark mode, and the rules for custom CSS, see Custom styling.

Accent color string​

Builds the hover, pressed, focus, and text colors of this widget from one color, in light and dark mode. Lists and menus that the widget opens use them too. Empty means the accent of the nearest container that sets one, or the theme accent.

Background string​

Sets the background of the input field box. Takes a theme color or a custom color.

Text color string​

Sets the text color of the input field box. Takes a theme color or a custom color. When it is empty and Background is set, the widget picks a readable text color.

Border color string​

Sets the border color of the input field box. Takes a theme color or a custom color. A color with no Border width draws a thin border.

Border width string​

Sets the border width of the input field box. Options: From theme (default), None, Thin, Medium, Thick. You cannot bind this property.

Corners string​

Sets the corner radius of the input field box. Options: From theme (default), Sharp, Rounded, Pill. You cannot bind this property.

Custom CSS string​

Adds plain CSS to this widget. Rules apply only inside the widget, and & is the box around the widget, its label included, not the part inside it. To style an inner part, use its element selector, for example button or input. You cannot bind this property.

Reference properties​

Reference properties let you read the widget's state in bindings and code, for example {{DatePicker1.isVisible}}. You cannot set them directly.

isVisible boolean​

Shows whether the widget is visible.

Example:

{{DatePicker1.isVisible}}

selectedDate string​

Holds the selected date as an ISO 8601 string. It is an empty string when no date is set.

Example:

{{DatePicker1.selectedDate}}

formattedDate string​

Holds the selected date in the format set in Date format. It is an empty string when no date is set.

Example:

{{DatePicker1.formattedDate}}

isDisabled boolean​

Shows whether the widget is disabled.

Example:

{{DatePicker1.isDisabled}}

Methods​

Methods let you change the widget's properties from code, for example in a JS Object.

setVisibility (param: boolean): Promise​

Shows or hides the widget.

Example:

DatePicker1.setVisibility(true)

setDisabled (param: boolean): Promise​

Turns the disabled state on or off.

Example:

DatePicker1.setDisabled(false)

Events​

onDateSelected​

Runs when the user selects or changes the date.

onFocus​

Runs when the date input gets focus.

onBlur​

Runs when the date input loses focus.