Datetime slider resets to original value on change

Hi, I’ve been trying to use a slider to filter rows on my dataframe, I managed to set up the slider but when I change the values on it the slider just resets to the original values and the dataframe isn’t filtered.

Slider and dataframe code below

import streamlit as st
import pandas as pd
import datetime

data = pd.read_csv('file.csv')

end_date = datetime.datetime.now()
start_date = end_date - datetime.timedelta(days=14)

slider = st.slider('Select date', min_value=start_date ,max_value=end_date,value=(start_date,end_date))
mask = (data['date'] >= slider[0]) & (data['date'] <= slider[1])
filter_data = data.loc[mask]

st.dataframe(filter_data,height=1000)

Can anyone give me a hand sorting this out?