Hey @Marisa_Smith,
this demo is simple and works.
Unfortunately the date_input loses its focus after I select the first date and then closes the selection window. Do you have any ideas where this might come from?
My code itself is quite big (~1,6k lines), with several functions prior and afterwards, thus it is not really practicable to share it hereâŠI crunched it down to only have auth and this date_input as filtering option (the rest is skipped) and I think it has to do with my login process, since the password is checked to equal a hashed password in a file, and this happens on every run (if it does not match the user is logged off).
But nontheless in a single setup with only the date_input, the code afterwards is still beeing executed, even though no second date is selected 
Is this the desired behaviour of this widget?? 
E.g. in your example if youâd try to access a_date[1] in a line like this:
st.write(âthis will result in an error after the first date is selectedâ, a_date[1])
The code will run into an error
import streamlit as st
import datetime
ss = st.session_state
base = datetime.date(2022,7,1)
## reading from pandas dataframe thus datetime objects
dates = [base + datetime.timedelta(days=x) for x in range(5)]
def updateDateRange():
if 'dateRange' in ss and isinstance(ss.dateRange, tuple) and len(ss.dateRange)==2:
### do some kind of magic for later use ###
ss.filter = {}
## convertion to string due to saving in json later on as default values
ss["filter"]['dateRange'] = (ss.dateRange[0].strftime("%d/%m/%Y"), ss.dateRange[1].strftime("%d/%m/%Y"))
a_date = st.date_input(
label="Select date range",
value=(dates[0], dates[-1]),
min_value=dates[0],
max_value=datetime.date.today(),
key="dateRange",
on_change=updateDateRange,
)
st.write("This is a test (shown whenever)", a_date[0])
if len(ss.dateRange)==2:
st.write("This i b test :P (only shown if start and end date are selected)", a_date[1])
st.write("this will result in an error after the first date is selected", a_date[1])