Hello @rafa-guides,
I got exactly the same error in my code. So far, I have found a temporary solution for myself to disable it in the streamlit source code. Just comment out the lines from 72-75 in the file:
..\.venv\Lib\site-packages\streamlit\elements\utils.py
My code example, when changing start_date, an error occurs.
import streamlit as st
from datetime import time, timedelta, datetime
today = datetime.now()
if not "all_day" in st.session_state:
st.session_state.all_day = False
def time_check():
sdt = st.session_state.start_date
edt = st.session_state.end_date
stm = st.session_state.start_time
etm = st.session_state.end_time
start = datetime.combine(sdt, stm)
end = datetime.combine(edt, etm)
if start > end:
st.session_state.end_time = (start + timedelta(minutes=30)).time()
st.session_state.end_date = (start + timedelta(minutes=30)).date()
container = st.container()
col1, col2, col3 = st.columns(3)
with container:
with col1:
start_date = st.date_input(
"start date",
min_value=today,
value=today,
on_change=time_check,
key="start_date",
)
end_date = st.date_input(
"end date",
min_value=start_date,
value=start_date,
on_change=time_check,
key="end_date",
disabled=st.session_state.all_day,
)
with col2:
start_time = st.time_input(
"start time",
value=time(8, 30),
on_change=time_check,
key="start_time",
disabled=st.session_state.all_day,
)
end_time = st.time_input(
"end time",
value=time(9, 0),
on_change=time_check,
key="end_time",
disabled=st.session_state.all_day,
)
with col3:
with st.expander(label="Options", expanded=True):
all_day = st.checkbox("All day", key="all_day")