| description | Datepicker widget reference |
|---|
This page describes the properties of the Datepicker widget which can be used to display or capture date/time information. It enables to filter the data based on a date range, format dates and performs date validations.
These properties are customizable options present in the property pane of the widget, allowing users to modify the widget according to their preferences.
Displays a list of date formats for the Datepicker widget. With JS enabled, this property accepts ISO 8601 date string formats.
You can also use the built-in Moment.js library in Appsmith to parse the date in the format required.
Example: If you want to convert the selected date and time to the IST timezone (Asia/Kolkata), click the JS button and add the following code:
{{
moment(datePickerName.selectedDate).tz("Asia/Kolkata").format()
}}Sets a default date that would be captured as user input unless it is changed by the user. With JS enabled, this property accepts ISO 8601 date string values.
Sets which day of the week appears first within the calendar of the Datepicker's menu.
Decides whether a time is included within the Datepicker, and whether that time is to the minute or second precision. With JS enabled, it accepts the follwoing values - None, minute, or second.
Sets the label text displayed in the Datepicker widget.
Enables you to designate the Datepicker widget as a mandatory field.
Sets a minimum date permitted to be selected in the widget. With JS enabled, this property accepts ISO 8601 date string values.
Sets a maximum date permitted to be selected with the widget. With JS enabled, this property accepts ISO 8601 date string values.
Sets a tooltip that appears when the user hovers over the widget. It enables you to add hints or provide additional information for the widget. Additionally, you can control it through JavaScript by clicking on the JS next to the property.
Controls the visibility of the widget. If you turn off this property, the widget is not visible in View mode. Additionally, you can use JavaScript by clicking on JS next to the Visible property to control the widget's visibility conditionally.
For example, if you want to make the widget visible only when the user checks an item in a Checkbox widget, you can use the following JavaScript expression in the visible property of the Datepicker widget:
{{Checkbox1.isChecked}}Prevents users from selecting the widget. Even though the widget remains visible, user input is not permitted. Additionally, you can use JavaScript by clicking on JS next to the Disabled property to control the widget's disabled state conditionally.
For example, if you want to allow only a specific user to interact with the Datepicker widget, you can use the following JavaScript expression:
{{appsmith.user.email=="john@appsmith.com"?false:true}}Controls whether the widget is displayed with a loading animation. When enabled, the widget shows a skeletal animation during the loading process. Additionally, you can control it through JavaScript by clicking on the JS next to the property.
When enabled, it adds section within the Datepicker pop-up that contains options - Today, 1 week ago, 1 month ago,3 months ago, 1 year ago, for quick date selection.
Sets whether the Datepicker menu should automatically close upon user selection of a date.
This property determines how the widget's height adjusts to changes in its content. There are three available options:
- Fixed: The height of the widget remains as set using drag and resize.
- Auto Height: The widget's height adjusts dynamically in response to changes in its content.
- Auto Height with limits: Same as Auto height, with a configurable option to set the minimum and maximum number of rows the widget can occupy.
When an event is triggered, these event handlers can execute queries, JS code, or other supported actions.
Triggered when the user selects a date in the Datepicker widget.
Triggered when the widget gets focus, when user clicks on the widget.
Triggered when the widget loses focus, when the user clicks outside of the widget or interacts with another entity on the page.
Style properties allow you to change the look and feel of the widget.
Enables you to set text color for the label. Additionally, click the JS button to programmatically modify the text color using JavaScript functions.
Enables you to control the size of the label text. Additionally, click the JS button to programmatically modify text size using JavaScript functions.
Enables you to choose a font style; bold or italic. Additionally, click the JS button to programmatically modify the font style using JavaScript functions.
Applies rounded corners to the outer edge of the widget. If JavaScript is enabled, you can specify valid CSS border-radius to adjust the radius of the corners.
This property adds a drop shadow effect to the frame of the widget. If JavaScript is enabled, you can specify valid CSS box-shadow values to customize the appearance of the shadow.
Reference properties enable you to access the widget's data and state using the dot operator in other widgets or JavaScript functions. They provide additional information or allow interaction with the widget programmatically. For instance, to retrieve the visibility status of a Datepicker widget, you can use Datepicker1.isVisible.
Contains the formatted date value currently selected within the Datepicker widget. This value changes if the default value is updated or the user inputs a new value. The format depends on the Date Format property set for the widget.
Example:
{{Datepicker1.formattedDate}}Contains the ISO date string value selected in the Datepicker widget. This value changes if the default value is updated or the user inputs a new value.
Example:
{{Datepicker1.selectedDate}}It reflects the state of the widget's Disabled setting. It is represented by a boolean value, where true indicates that the widget is disabled, and false indicates that it is enabled for user interaction.
Example:
{{Datepicker1.isDisabled}}The isVisible property indicates the visibility state of a widget, with true indicating it is visible and false indicating it is hidden.
Example:
{{Datepicker1.isVisible}}Widget property setters enable you to modify the values of widget properties at runtime, eliminating the need to manually update properties in the editor.
These methods are asynchronous and return a Promise. You can use the .then() block to ensure execution and sequencing of subsequent lines of code in Appsmith.
Sets the visibility of the widget.
Example:
DatePicker1.setVisibility(true)Sets the disabled state of the widget.
Example:
DatePicker1.setDisabled(false)Allows you to dynamically set the value of the widget.
Example:
DatePicker1.setValue('11-01-1994')Sets whether the widget is required or not.
Example:
DatePicker1.setRequired(true)- Filter Data for Specific Date Ranges – Learn how to filter data for specific date ranges using SQL queries.
- Search and Filter Table Data – See how to search and filter Table data efficiently to display relevant results.