DateRangePicker / DatePicker
DatePicker
selectors.DatePicker
Creates a date picker selector. It allows you to select single date.
| Parameter | Description | Default |
|---|---|---|
| selector_name | The name of the selector. It must be unique. | - |
| default_value | If the selected option is invalid, this variable is used. date should match format DD/MM/YYYY | |
| label | The label for the selector. If not passed, the selector shows its selector_name. | - |
| timePicker | If True, the selector will allow input of hours and minutes. | False |
| help_text | Tooltip help message displayed on hover. | - |
| width | Custom selector width. | - |
| isDisabled | disable this selector. | False |
| block_uuid | Optional value to specify the block that will be executed when the selector triggers execution. | (current block uuid) |
| min_date | An optional parameter that specifies the minimum date that can be selected in the selector with format DD/MM/YYYY. This can be used to restrict the user from selecting dates before a certain date. | - |
| max_date | An optional parameter that specifies the maximum date that can be selected in the selector with format DD/MM/YYYY.. This can be used to restrict the user from selecting dates after a certain date. | - |
DateRangePicker
selectors.DateRangePicker
Creates a date-range picker selector. It allows you to select two dates as begin and end date.
| Parameter | Description | Default |
|---|---|---|
| selector_name | The name of the selector. It must be unique. | - |
| default_value | If the selected option is invalid, this variable is used. date should match format DD/MM/YYYY | |
| label | The label for the selector. If not passed, the selector shows its selector_name. | - |
| timePicker | If True, the selector will allow input of hours and minutes. Default is False. | |
| help_text | Tooltip help message displayed on hover. | - |
| width | Custom selector width. | - |
| isDisabled | disable this selector. | False |
| block_uuid | Optional value to specify the block that will be executed when the selector triggers execution. | (current block uuid) |
| min_date | An optional parameter that specifies the minimum date that can be selected in the selector with format DD/MM/YYYY.. This can be used to restrict the user from selecting dates before a certain date. | |
| max_date | An optional parameter that specifies the maximum date that can be selected in the selector with format DD/MM/YYYY.. This can be used to restrict the user from selecting dates after a certain date. |
Examples:
sel = selectors.DatePicker(
'DatePicker-0',
label='Choose a date',
default_value='07/09/2022',
placeholder='This is a placeholder text'
)
sel.render()
print("The date selected id:", sel.value)
from IPython.display import display, HTML
elements =[]
picker = selectors.DatePicker(
'DatePicker-1',
label='A single date for A',
default_value='07/09/2017',
placeholder='This is a placeholder text'
)
elements.append(picker)
picker = selectors.DateRangePicker(
'daterangepicker-2',
label='select a range of dates',
help_text='help text',
default_value='05/05/2017-29/06/2017'
)
elements.append(picker)
picker = selectors.DateRangePicker(
'daterangepicker-3',
label='select a range of dates and time',
help_text='help text',
default_value='05/05/2017-29/06/2017',
timePicker=True
)
elements.append(picker)
elements_html = "".join(
f'<tr><td>{element}</td><td>{element.value}</td></tr>'
for element in elements
)
display(HTML(f"""
<table>
{elements_html}
</table>
"""))
timezones
In these selectors we follow a naive approach to handle dates.
See also
- MonthDatePicker / MonthDateRangePicker — pick only the month/year part of a date.
- All selector types — the full catalog of available selector controls.
- Selectors — common arguments and how to define, render, and read selectors.