Skip to content

Commit

Permalink
Switch DatetimePicker start/end to param.Date (#3202)
Browse files Browse the repository at this point in the history
* Switch DatetimePicker start/end to param.Date

* Update docs
  • Loading branch information
philippjfr authored Mar 8, 2022
1 parent 978f291 commit b906e68
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
8 changes: 4 additions & 4 deletions examples/reference/widgets/DatetimePicker.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
"##### Core\n",
"\n",
"* **``value``** (datetime): The selected value as a datetime type\n",
"* **``start``** (date): Start date of the widget\n",
"* **``end``** (date): End date of the widget\n",
"* **``start``** (date or datetime): Inclusive lower bound of the allowed date selection. Note that while the parameter accepts datetimes the time portion of the range is ignored.\n",
"* **``end``** (date or datetime): Inclusive upper bound of the allowed date selection. Note that while the parameter accepts datetimes the time portion of the range is ignored.\n",
"* **``disabled_dates``** (list): Dates to make unavailable for selection; others will be available\n",
"* **``enabled_dates``** (list): Dates to make available for selection; others will be unavailable\n",
"* **``enable_time:``** (boolean): Enable change of the time in the widget, default is True\n",
"* **``enable_seconds:``** (boolean): Enable change of the seconds in the widget, default is True\n",
"* **``enable_time:``** (boolean): Enable editing of the time in the widget, default is True\n",
"* **``enable_seconds:``**g (boolean): Enable editing of seconds in the widget, default is True\n",
"* **``military_time:``** (boolean): Enable 24 hours time in the widget, default is True\n",
"\n",
"\n",
Expand Down
10 changes: 5 additions & 5 deletions examples/reference/widgets/DatetimeRangePicker.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"##### Core\n",
"\n",
"* **``value``** (tuple): Tuple of upper and lower bounds of the selected range expressed as datetime types\n",
"* **``start``** (date): Start date of the widget\n",
"* **``end``** (date): End date of the widget\n",
"* **``start``** (date or datetime): Inclusive lower bound of the allowed date selection. Note that while the parameter accepts datetimes the time portion of the range is ignored.\n",
"* **``end``** (date or datetime): Inclusive upper bound of the allowed date selection. Note that while the parameter accepts datetimes the time portion of the range is ignored.\n",
"* **``disabled_dates``** (list): Dates to make unavailable for selection; others will be available\n",
"* **``enabled_dates``** (list): Dates to make available for selection; others will be unavailable\n",
"* **``enable_time:``** (boolean): Enable change of the time in the widget, default is True\n",
"* **``enable_seconds:``** (boolean): Enable change of the seconds in the widget, default is True\n",
"* **``military_time:``** (boolean): Enable 24 hours time in the widget, default is True\n",
"* **``enable_time:``** (boolean): Enable editing of the time in the widget, default is True\n",
"* **``enable_seconds:``** (boolean): Enable editing of seconds in the widget, default is True\n",
"* **``military_time:``** (boolean): Whether to display time in 24 hour format, default is True\n",
"\n",
"\n",
"##### Display\n",
Expand Down
26 changes: 19 additions & 7 deletions panel/widgets/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,30 @@ def _process_property_change(self, msg):

class _DatetimePickerBase(Widget):

start = param.CalendarDate(default=None)
disabled_dates = param.List(default=None, class_=(date, str), doc="""
Dates to make unavailable for selection.""")

end = param.CalendarDate(default=None)
enabled_dates = param.List(default=None, class_=(date, str), doc="""
Dates to make available for selection.""")

disabled_dates = param.List(default=None, class_=(date, str))
enable_time = param.Boolean(default=True, doc="""
Enable editing of the time in the widget.""")

enabled_dates = param.List(default=None, class_=(date, str))
enable_seconds = param.Boolean(default=True, doc="""
Enable editing of the seconds in the widget.""")

enable_time = param.Boolean(default=True)
end = param.Date(default=None, doc="""
Inclusive upper bound of the allowed date selection. Note that while
the parameter accepts datetimes the time portion of the range
is ignored.""")

enable_seconds = param.Boolean(default=True)
military_time = param.Boolean(default=True, doc="""
Whether to display time in 24 hour format.""")

military_time = param.Boolean(default=True)
start = param.Date(default=None, doc="""
Inclusive lower bound of the allowed date selection. Note that while
the parameter accepts datetimes the time portion of the range
is ignored.""")

_source_transforms = {'value': None, 'start': None, 'end': None, 'mode': None}

Expand Down Expand Up @@ -244,6 +255,7 @@ def _deserialize_value(self, value):


class DatetimeRangePicker(_DatetimePickerBase):

value = param.DateRange(default=None)

mode = param.String('range', constant=True)
Expand Down

0 comments on commit b906e68

Please sign in to comment.