You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means the st.date_input() date validation introduced in #10764 incorrectly warns the date ranges inputted by the quick select drop down (Past Week, Past Month...) has an invalid upper date when st.date_input() is called with max_value=datetime.now().date(), because today 12:00 (BaseWeb Date) > today 00:00 (Streamlit max_date).
Reproducible Code Example
importdatetimeimportstreamlitassttoday=datetime.datetime.now().date()
min_date=today-datetime.timedelta(days=800)
min_date, todayd=st.date_input(
"Input date range",
value=(min_date, today),
min_value=min_date,
max_value=today,
format="MM.DD.YYYY",
)
d
Steps To Reproduce
Screencast_20250822_230006.webm
Expected Behavior
A way to fix this would be to change the Date objects returned by BaseWeb quick select by stripping the 12:00 time component to just 00:00.
This would mean the validation introduced by #10764 would always be making 00:00 Date comparisons, and the quick select date ranges would pass validation correctly when st.date_input(..., max_value=datetime.now().date(), ...).
Checklist
Summary
#10166 added a date range quick select drop down to
st.date_input()which uses BaseWeb's stateful quick select datepicker. That component returns JavaScriptDateinstances anchored at 12:00:00 (midday).This means the
st.date_input()date validation introduced in #10764 incorrectly warns the date ranges inputted by the quick select drop down (Past Week, Past Month...) has an invalid upper date whenst.date_input()is called withmax_value=datetime.now().date(), because today 12:00 (BaseWeb Date) > today 00:00 (Streamlitmax_date).Reproducible Code Example
Steps To Reproduce
Screencast_20250822_230006.webm
Expected Behavior
A way to fix this would be to change the
Dateobjects returned by BaseWeb quick select by stripping the 12:00 time component to just 00:00.I.e. put operations like this:
dateObject.setHours(0, 0, 0, 0);into https://github.com/streamlit/streamlit/blob/develop/frontend/lib/src/components/widgets/DateInput/DateInput.tsxThis would mean the validation introduced by #10764 would always be making 00:00
Datecomparisons, and the quick select date ranges would pass validation correctly whenst.date_input(..., max_value=datetime.now().date(), ...).Current Behavior
See vid
Is this a regression?
Debug info
Additional Information
No response