Does Streamlit have an equivalent of Daterangeslider — Panel 0.11.3 documentation?
@cjw296,
The slider object supports date. From the documentation:
from datetime import datetime
import streamlit as st
start_time = st.slider(
"When do you start?",
value=datetime(2020, 1, 1, 9, 30),
format="MM/DD/YY -hh:mm"
)
Sure, but that’s a single date slider, rather than the daterange slider I’m after…
Fair point, I missed that. Perhaps this discussion might shed some light on current status
Hi @cjw296,
As the documentation states:
value ( a supported type or a tuple/list of supported types or None ) – The value of the slider when it first renders. If a tuple/list of two values is passed here, then a range slider with those lower and upper bounds is rendered. For example, if set to (1, 10) the slider will have a selectable range between 1 and 10. Defaults to min_value.
So simply pass a tuple with 2 datetime values in the value argument, and a range slider will be rendered. The widget will return a tuple with upper and lower bound of the selected range.
Hope this helps!
Here the example:
cols1, _ = st.beta_columns((1,2))
slider = cols1.slider('Select date', min_value=start_date, value=(start_date, end_date), max_value=end_date, format=format)