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

date_input crashes if its empty #3194

Closed
BugzTheBunny opened this issue Apr 29, 2021 · 2 comments
Closed

date_input crashes if its empty #3194

BugzTheBunny opened this issue Apr 29, 2021 · 2 comments
Assignees
Labels
good first issue Good for newcomers status:confirmed Bug has been confirmed by the Streamlit team type:bug Something isn't working

Comments

@BugzTheBunny
Copy link

Summary

While building an app and testing it I've noticed that when you use date_input it can crash if you delete everything there manually, it crashes as the time format is not correct, and when you try to try/catch it, there is no real way to overcome it, because if I recreate the widget, it needs a new key.. so you can really wrap it as far as I know.

Steps to reproduce

Code snippet:

import streamlit as st
import datetime as dt
x = st.date_input('select date',value = dt.datetime.now())

(Please provide a code snippet! This will help expedite us finding and solving the problem.)

If applicable, please provide the steps we should take to reproduce the bug:

  1. Run the code above
  2. Delete the input manually
  3. The app will crash.

Expected behavior:

Would be awesome if the date would reset to the default value which is set, or at least to the current time.

Actual behavior:

Explain the buggy behavior you experience when you go through the steps above.
If applicable, add screenshots to help explain your problem.

Debug info

  • Streamlit version: 0.79
  • Python version: 3.8
  • Using Conda
  • OS version: Win10 / CentOS/ Ubuntu
  • Browser version: Any
@BugzTheBunny BugzTheBunny added type:bug Something isn't working status:needs-triage Has not been triaged by the Streamlit team labels Apr 29, 2021
@kmcgrady kmcgrady added good first issue Good for newcomers status:confirmed Bug has been confirmed by the Streamlit team and removed status:needs-triage Has not been triaged by the Streamlit team labels May 22, 2021
@kmcgrady
Copy link
Collaborator

Hi @BugzTheBunny Thanks for the report! I was able to reproduce this issue and marked it to fix in a bug project. I also marked this as a good first issue because the solution seems straightforward! Essentially, the frontend should send back a valid output, or the backend should interpret invalid output without throwing an exception.

@kajarenc
Copy link
Collaborator

@BugzTheBunny This bug has been fixed and it will be included in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers status:confirmed Bug has been confirmed by the Streamlit team type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants