Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Fix missing session when trying to display an error duing bookmarking. (#1984)

* `input_date()` and `input_date_range()` once again use the client's (not the server) current date as the default `value`. (#2060)

* Fixed `set()` method of `InputSelectize` controller so it clears existing selections before applying new values. (#2024)

### Deprecations
Expand Down
15 changes: 6 additions & 9 deletions shiny/ui/_input_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from htmltools import Tag, TagAttrValue, TagChild, css, div, span, tags

from .._docstring import add_example
from .._namespaces import resolve_id
from ..bookmark import restore_input
from ..module import resolve_id
from ._html_deps_external import datepicker_deps
from ._utils import shiny_input_label

Expand Down Expand Up @@ -112,13 +112,11 @@ def input_date(
"""

resolved_id = resolve_id(id)
default_value = value if value is not None else date.today()

return div(
shiny_input_label(resolved_id, label),
_date_input_tag(
id=resolved_id,
value=restore_input(resolved_id, default_value),
value=restore_input(resolved_id, value),
min=min,
max=max,
format=format,
Expand Down Expand Up @@ -233,15 +231,14 @@ def input_date_range(
"""

resolved_id = resolve_id(id)
default_start = start if start is not None else date.today()
default_end = end if end is not None else date.today()
restored_date_range = restore_input(resolved_id, [default_start, default_end])
start, end = tuple(restore_input(resolved_id, [start, end]))

return div(
shiny_input_label(resolved_id, label),
div(
_date_input_tag(
id=resolved_id,
value=restored_date_range[0],
value=start,
min=min,
max=max,
format=format,
Expand All @@ -257,7 +254,7 @@ def input_date_range(
),
_date_input_tag(
id=resolved_id,
value=restored_date_range[1],
value=end,
min=min,
max=max,
format=format,
Expand Down
Loading