Set slider range


Hi I would like to set a range for the slider - for example 1 day or 3 days. At the moment there is no set range so user can choose range from 2 to more than 1000 days.

Steps to reproduce

Code snippet:

def df_filter(message,df):
   dates_selection = st.slider('%s' % (message),
                               min_value = min(df['Date']),
                               max_value = max(df['Date']),
                               value =(min(df['Date']),max(df['Date'])))
   mask = df['Date'].between(*dates_selection)
   number_of_result = df[mask].shape[0]
   filtered_df = df[mask]
   return filtered_df

if __name__ == '__main__':
   df = pd.DataFrame(heartrate_new)

   st.header('Datetime Filter')
   filtered_df = df_filter('Move sliders to filter dataframe',df)
   filtered_df.sort_values(by='Date', inplace = True)

   container1 = st.container()
   with container1:
      st.header('Data Frame')

Additional information

If needed, add any other context about the problem here.

Hey @alice3503,

The range of the slider is just coming from the difference between the min_value and max_value that youโ€™re setting. Have you tried setting the max_value to be min(df['Date']) + 3 days (or however many days youโ€™re hoping to limit the range to)?