Time Picker
Last Updated: July 2026
- class tethys_sdk.gizmos.TimePicker(name, display_text='', default_time='', minute_step=15, second_step=30, show_seconds=False, show_meridian=True, show_inputs=True, disable_focus=False, snap_to_step=False, max_hours=24, explicit_mode=False, initial='', disabled=False, error='', success='', attributes=None, classes='')
Time pickers are used to make the input of times streamlined and easy. Rather than typing the time, the user is presented with a spinner-style widget to select the time. This time picker was implemented using Bootstrap Timepicker.
- default_time
The time to display when the picker is first opened with no value (e.g.: '2:30 PM'). Use 'current' to default to the current time.
- Type:
str
- show_meridian
Set whether to use a 12-hour clock with an AM/PM selector (True) or a 24-hour clock (False).
- Type:
bool
- max_hours
Specify a maximum number of hours the widget will spin up to (only applies with a 24-hour clock).
- Type:
int
- explicit_mode
When True, the user may enter a time without a colon (e.g.: '0900' becomes '09:00').
- Type:
bool
- attributes
A dictionary representing additional HTML attributes to add to the primary element (e.g. {"onclick": "run_me();"}).
- Type:
dict
- classes
Additional classes to add to the primary HTML element (e.g. "example-class another-class").
- Type:
str
Controller Example
from tethys_sdk.gizmos import TimePicker # Time Picker Options time_picker = TimePicker(name='time1', display_text='Time', minute_step=15, show_meridian=True, default_time='2:30 PM', initial='2:30 PM') time_picker_error = TimePicker(name='time2', display_text='Time', initial='10:00 AM', disabled=True, error='Here is my error text.') context = { 'time_picker': time_picker, 'time_picker_error': time_picker_error, }Template Example
{% load tethys_gizmos %} {% gizmo time_picker %} {% gizmo time_picker_error %}