How to input st.date_input as None,


I want list some action plan, it will use date input, how to set the data as none, the st_date_input value Defaults should be today? and it can’t set none? how to do?

import streamlit as st

date = st.date_input("date")
if date is not None:
    st.write("Date is:", date)
    st.write("Date is none。")

Steps to reproduce

Code snippet:

add code here

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.


  • Link to your GitHub repo:
  • Link to your deployed app:

Additional information

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

This is not supported yet.

Try this hack if it suits on your case. Just create an initial date value. If that value is set, consider it as None.

import streamlit as st
from datetime import datetime 

init_date_str = '1960-01-01'
init_date_dt = datetime.strptime(init_date_str, "%Y-%m-%d")

date = st.date_input("date", value=init_date_dt)

if date !=
    st.write("Date is:", date)
    st.write("Date is none.")


I have tried to this, it can’t use, because it the defaults date is 1966-1-1, if we select the data, all start with 1966-1-1, not today button, and select year controlled only +/- 10 years

You can define a max_value.

date = st.date_input(
    max_value=datetime.strptime("2100-01-01", "%Y-%m-%d")