Skip to content

fix(input_date): datesdisabled ignored non-default format - #2523

Merged
cpsievert merged 3 commits into
posit-dev:mainfrom
taekop:fix-input-date-datesdisabled-format
Oct 7, 2026
Merged

cpsievert merged 3 commits into
posit-dev:mainfrom
taekop:fix-input-date-datesdisabled-format

Conversation

@taekop

@taekop taekop commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

fix(input_date): datesdisabled ignored non-default format

Port of rstudio/shiny#4434 (fixes rstudio/shiny#4281) to ui.input_date(). cpsievert asked for this port in the review on rstudio/shiny#4434.

datesdisabled is always yyyy-mm-dd, but it was emitted as data-date-dates-disabled, which bootstrap-datepicker picks up itself and parses with the display format. With any non-default format the dates never matched, so nothing was disabled.

Changes:

  • ui.input_date() now emits data-dates-disabled (not data-date-*), so the client binding parses it as yyyy-mm-dd, the same way it handles min/max. The attribute is omitted when datesdisabled is None.
  • controller.InputDate.expect_datesdisabled() checks the new attribute (and expects it to be absent for None). The description in the generated testing docs is updated to match.
  • Vendored assets are synced in a separate build: commit (first commit), generated with make upgrade-html-deps against rstudio/shiny main at bbc43849, which is the merge commit of fix: dateInput() datesdisabled ignored non-default format (#4281) rstudio/shiny#4434. The shiny JS change in that commit is exactly the #4434 change (13 added lines in shiny.js, plus the regenerated .min.js and source maps). The same run also picked up the current rstudio/bslib main (97aa1abc -> ac1e25f8): bslib/components CSS/JS, page_sidebar.scss, toolbar.scss, and the regenerated bootstrap CSS. The commit totals 16 files, +57/-32.
  • Added a pytest test for the rendered attributes and a Playwright test that opens the picker and checks the disabled days for dd/mm/yyyy and mm/dd/yy, and that the value survives a 2-digit-year format.
  • CHANGELOG entry.

input_date_range() has no datesdisabled argument (same as dateRangeInput() in R), so nothing changes there.

Testing (local, chromium):

  • The new Playwright test fails on main and with only the Python change on top of the old vendored JS ([] == ['1', '2']: no days disabled). It passes with the build: commit.
  • tests/pytest: 1226 passed, 6 skipped.
  • Existing date-related Playwright tests (input_datepicker, input_daterange, test_input_date, test_input_date_range, test_inputs_update, and the ai_generated_apps input_date / input_date_range core and bookmark apps): 12 passed.
  • uv run make format check-lint check-types pass.

testing-documentation.json was edited by hand because make update-testing-docs needs quarto and repomix, which are not available here. It matches what the generator would produce: the description column is the first line of the docstring, and the signature is unchanged.

taekop added 2 commits October 5, 2026 13:26
Ran `make upgrade-html-deps`. Pulls rstudio/shiny@main (bbc43849, the
#4434 merge commit) and rstudio/bslib@main (97aa1abc -> ac1e25f8).
Emit data-dates-disabled instead of data-date-dates-disabled so the dates are parsed as yyyy-mm-dd by the client binding rather than by bootstrap-datepicker with the display format. Omit the attribute when datesdisabled is None. Update InputDate.expect_datesdisabled() to match. Needs the shiny.js from rstudio/shiny#4434.
@cpsievert
cpsievert merged commit 5bfb7c6 into posit-dev:main Oct 7, 2026
174 of 175 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

datesdisabled in dateInput does not work for non-yyyy-mm-dd formats

2 participants