/
datetime_picker.py
66 lines (49 loc) · 1.77 KB
/
datetime_picker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from bokeh.core.enums import CalendarPosition
from bokeh.core.properties import (
Bool,
Date,
Datetime,
Either,
Enum,
List,
Nullable,
String,
Tuple,
)
from bokeh.models.widgets.inputs import InputWidget
class DatetimePicker(InputWidget):
''' Calendar-based date picker widget.
'''
value = String(help="""
The initial or picked date.
""")
min_date = Nullable(Either(Date, Datetime), help="""
Optional earliest allowable date.
""")
max_date = Nullable(Either(Date, Datetime), help="""
Optional latest allowable date.
""")
disabled_dates = List(Either(Date, Datetime, Tuple(Date, Date), Tuple(Datetime, Datetime)), default=[], help="""
A list of dates of ``(start, end)`` date ranges to make unavailable for
selection. All other dates will be avalable.
.. note::
Only one of ``disabled_dates`` and ``enabled_dates`` should be specified.
""")
enabled_dates = List(Either(Date, Datetime, Tuple(Date, Date), Tuple(Datetime, Datetime)), default=[], help="""
A list of dates of ``(start, end)`` date ranges to make available for
selection. All other dates will be unavailable.
.. note::
Only one of ``disabled_dates`` and ``enabled_dates`` should be specified.
""")
position = Enum(CalendarPosition, default="auto", help="""
Where the calendar is rendered relative to the input when ``inline`` is False.
""")
inline = Bool(default=False, help="""
Whether the calendar sholud be displayed inline.
""")
enable_time = Bool(default=True)
enable_seconds = Bool(default=True)
military_time = Bool(default=True)
date_format = String("Y-m-d H:i:S")
mode = String(default="single", help="""
Should either be "single" or "range".""")