Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch DatetimePicker start/end to param.Date #3202

Merged
merged 2 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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