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

Don't error on malformed date input #1139

Merged
merged 3 commits into from
Feb 26, 2024
Merged

Don't error on malformed date input #1139

merged 3 commits into from
Feb 26, 2024

Conversation

wch
Copy link
Collaborator

@wch wch commented Feb 16, 2024

This fixes #1138.

This returns None for each malformed date component. If it's a date range, then it returns a length-2 tuple where either or both components could be None. I thought this behavior seemed reasonable, but I'm open to other ideas. Another possibility is to simply not change and invalidate input.x() until there's a valid value, but I think that fix would be a bit more involved.

Update: I've thought about this a bit more, and I think the behavior in this PR is what we should go with -- the UI component can have an empty value, and I think it makes sense to reflect that in the server-side input value (as opposed to not changing the input value until there's a valid value in the UI).

@wch wch added this to the v0.8.0 milestone Feb 16, 2024
@jcheng5
Copy link
Collaborator

jcheng5 commented Feb 26, 2024

LGTM

@wch wch marked this pull request as ready for review February 26, 2024 23:09
@wch wch merged commit ce53433 into main Feb 26, 2024
14 checks passed
@wch wch deleted the safe-input-date branch February 26, 2024 23:09
schloerke added a commit that referenced this pull request Feb 27, 2024
* main:
  Update `@render.data_frame` renderer to work properly with fill/fillable (#1126)
  Don't error on malformed date input (#1139)
  fix(nav_panel): Add `.bslib-gap-spacing` if nav panel is fillable (#1154)
  feat: Add `ui.input_dark_mode()` (#1149)
  chore(make): Add `make docs` and `make docs-preview` (#1150)
  Sync with latest bslib sidebar and card changes (#1129)
  docs(input_task_button): Add to reference index, also update methods for action button/link (#1151)
  chore(make): Update check and check-fix to replicate CI (#1148)
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.

Date selector component crashes shiny process on invalid input
2 participants