How to fix error: "StreamlitAPIException: DateInput value should either be an date/datetime or a list/tuple of 0 - 2 date/datetime values"?

  1. I am running my app locally
  2. The app is not deployed.
  3. GitHub - WaqarQureshii/stock_market_assessment at streamlit-WTDOLLE
  4. StreamlitAPIException: DateInput value should either be an date/datetime or a list/tuple of 0 - 2 date/datetime values

Traceback:

File "/Users/Waqar/Documents/GitHub/stock_py_project/stock_market_assessment/streamlit/pages/1 - WTDOLLE.py", line 18, in <module>
    input_end_date = st.date_input(label = 'Choose date', value = today_date)

The date that I’m feeding it is:

def last_biz_date():
    today = datetime.today()
    last_biz_day = pd.date_range(end=today - timedelta(days=1), periods=1, freq='B')[0]
    last_biz_date = datetime.strptime(last_biz_date, '%Y-%m-%d')
    return last_biz_day

Feeding it as follows:

today_date = last_biz_date()
input_end_date = st.date_input(label = 'Choose date', value = today_date)
  1. Streamlit version: 1.28.2, python 3.11.2