Skip to main content

DateRangePicker / DatePicker

DatePicker​

selectors.DatePicker

Creates a date picker selector. It allows you to select single date.

ParameterDescriptionDefault
selector_nameThe name of the selector. It must be unique.-
default_valueIf the selected option is invalid, this variable is used. date should match format DD/MM/YYYY
labelThe label for the selector. If not passed, the selector shows its selector_name.-
timePickerIf True, the selector will allow input of hours and minutes.False
help_textTooltip help message displayed on hover.-
widthCustom selector width.-
isDisableddisable this selector.False
block_uuidOptional value to specify the block that will be executed when the selector triggers execution.(current block uuid)
min_dateAn 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_dateAn 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.

ParameterDescriptionDefault
selector_nameThe name of the selector. It must be unique.-
default_valueIf the selected option is invalid, this variable is used. date should match format DD/MM/YYYY
labelThe label for the selector. If not passed, the selector shows its selector_name.-
timePickerIf True, the selector will allow input of hours and minutes. Default is False.
help_textTooltip help message displayed on hover.-
widthCustom selector width.-
isDisableddisable this selector.False
block_uuidOptional value to specify the block that will be executed when the selector triggers execution.(current block uuid)
min_dateAn 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_dateAn 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​