prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Month dropdown on DateInput is very slow (~5s to appear)
  # Summary
  
  Month dropdown on DateInput is very slow (~5s to appear). See https://i.imgur.com/WkmHYag.gifv
  
  # Steps to reproduce
  
  What are the steps we should take to reproduce the bug:
  
  1. Create `st.date_input('hi')`
  2. Click on the date
  3. Click on the month inside the date
  
  ## Expected behavior:
  
  Month dropdown should appear almost instantly, with no user-perceived lag.
  
  ## Actual behavior:
  
  Takes ~5 seconds
  
  ## Is this a regression?
  
  Unsure. Does this date input dropdown use our virtualized selectbox?
  
  # Debug info
  
  - Streamlit version: develop
  - Python version: 3.7.6
  - Using Pipenv
  - OS version: Windows 10
  - Browser version: Chrome
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `lib/streamlit/elements/time_widgets.py`
  Content:
  ```
  1 from datetime import datetime, date, time
  2 
  3 from streamlit.proto.TimeInput_pb2 import TimeInput as TimeInputProto
  4 from streamlit.proto.DateInput_pb2 import DateInput as DateInputProto
  5 from streamlit.errors import StreamlitAPIException
  6 from .utils import _get_widget_ui_value
  7 
  8 
  9 class TimeWidgetsMixin:
  10     def time_input(dg, label, value=None, key=None):
  11         """Display a time input widget.
  12 
  13         Parameters
  14         ----------
  15         label : str
  16             A short label explaining to the user what this time input is for.
  17         value : datetime.time/datetime.datetime
  18             The value of this widget when it first renders. This will be
  19             cast to str internally. Defaults to the current time.
  20         key : str
  21             An optional string to use as the unique key for the widget.
  22             If this is omitted, a key will be generated for the widget
  23             based on its content. Multiple widgets of the same type may
  24             not share the same key.
  25 
  26         Returns
  27         -------
  28         datetime.time
  29             The current value of the time input widget.
  30 
  31         Example
  32         -------
  33         >>> t = st.time_input('Set an alarm for', datetime.time(8, 45))
  34         >>> st.write('Alarm is set for', t)
  35 
  36         """
  37         # Set value default.
  38         if value is None:
  39             value = datetime.now().time()
  40 
  41         # Ensure that the value is either datetime/time
  42         if not isinstance(value, datetime) and not isinstance(value, time):
  43             raise StreamlitAPIException(
  44                 "The type of the value should be either datetime or time."
  45             )
  46 
  47         # Convert datetime to time
  48         if isinstance(value, datetime):
  49             value = value.time()
  50 
  51         time_input_proto = TimeInputProto()
  52         time_input_proto.label = label
  53         time_input_proto.default = time.strftime(value, "%H:%M")
  54 
  55         ui_value = _get_widget_ui_value("time_input", time_input_proto, user_key=key)
  56         current_value = (
  57             datetime.strptime(ui_value, "%H:%M").time()
  58             if ui_value is not None
  59             else value
  60         )
  61         return dg._enqueue("time_input", time_input_proto, current_value)  # type: ignore
  62 
  63     def date_input(
  64         dg,
  65         label,
  66         value=None,
  67         min_value=datetime.min,
  68         max_value=None,
  69         key=None,
  70     ):
  71         """Display a date input widget.
  72 
  73         Parameters
  74         ----------
  75         label : str
  76             A short label explaining to the user what this date input is for.
  77         value : datetime.date or datetime.datetime or list/tuple of datetime.date or datetime.datetime or None
  78             The value of this widget when it first renders. If a list/tuple with
  79             0 to 2 date/datetime values is provided, the datepicker will allow
  80             users to provide a range. Defaults to today as a single-date picker.
  81         min_value : datetime.date or datetime.datetime
  82             The minimum selectable date. Defaults to datetime.min.
  83         max_value : datetime.date or datetime.datetime
  84             The maximum selectable date. Defaults to today+10y.
  85         key : str
  86             An optional string to use as the unique key for the widget.
  87             If this is omitted, a key will be generated for the widget
  88             based on its content. Multiple widgets of the same type may
  89             not share the same key.
  90 
  91         Returns
  92         -------
  93         datetime.date
  94             The current value of the date input widget.
  95 
  96         Example
  97         -------
  98         >>> d = st.date_input(
  99         ...     "When\'s your birthday",
  100         ...     datetime.date(2019, 7, 6))
  101         >>> st.write('Your birthday is:', d)
  102 
  103         """
  104         # Set value default.
  105         if value is None:
  106             value = datetime.now().date()
  107 
  108         single_value = isinstance(value, (date, datetime))
  109         range_value = isinstance(value, (list, tuple)) and len(value) in (0, 1, 2)
  110         if not single_value and not range_value:
  111             raise StreamlitAPIException(
  112                 "DateInput value should either be an date/datetime or a list/tuple of "
  113                 "0 - 2 date/datetime values"
  114             )
  115 
  116         if single_value:
  117             value = [value]
  118 
  119         date_input_proto = DateInputProto()
  120         date_input_proto.is_range = range_value
  121 
  122         value = [v.date() if isinstance(v, datetime) else v for v in value]
  123 
  124         date_input_proto.label = label
  125         date_input_proto.default[:] = [date.strftime(v, "%Y/%m/%d") for v in value]
  126 
  127         if isinstance(min_value, datetime):
  128             min_value = min_value.date()
  129 
  130         date_input_proto.min = date.strftime(min_value, "%Y/%m/%d")
  131 
  132         if max_value is None:
  133             today = date.today()
  134             max_value = date(today.year + 10, today.month, today.day)
  135 
  136         if isinstance(max_value, datetime):
  137             max_value = max_value.date()
  138 
  139         date_input_proto.max = date.strftime(max_value, "%Y/%m/%d")
  140 
  141         ui_value = _get_widget_ui_value("date_input", date_input_proto, user_key=key)
  142 
  143         if ui_value is not None:
  144             value = getattr(ui_value, "data")
  145             value = [datetime.strptime(v, "%Y/%m/%d").date() for v in value]
  146 
  147         return_value = value[0] if single_value else tuple(value)
  148         return dg._enqueue("date_input", date_input_proto, return_value)  # type: ignore
  149
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/lib/streamlit/elements/time_widgets.py b/lib/streamlit/elements/time_widgets.py
  --- a/lib/streamlit/elements/time_widgets.py
  +++ b/lib/streamlit/elements/time_widgets.py
  @@ -61,12 +61,7 @@
           return dg._enqueue("time_input", time_input_proto, current_value)  # type: ignore
   
       def date_input(
  -        dg,
  -        label,
  -        value=None,
  -        min_value=datetime.min,
  -        max_value=None,
  -        key=None,
  +        dg, label, value=None, min_value=None, max_value=None, key=None,
       ):
           """Display a date input widget.
   
  @@ -79,7 +74,7 @@
               0 to 2 date/datetime values is provided, the datepicker will allow
               users to provide a range. Defaults to today as a single-date picker.
           min_value : datetime.date or datetime.datetime
  -            The minimum selectable date. Defaults to datetime.min.
  +            The minimum selectable date. Defaults to today-10y.
           max_value : datetime.date or datetime.datetime
               The maximum selectable date. Defaults to today+10y.
           key : str
  @@ -126,6 +121,9 @@
   
           if isinstance(min_value, datetime):
               min_value = min_value.date()
  +        elif min_value is None:
  +            today = date.today()
  +            min_value = date(today.year - 10, today.month, today.day)
   
           date_input_proto.min = date.strftime(min_value, "%Y/%m/%d")
  
verification_info: {"golden_diff": "diff --git a/lib/streamlit/elements/time_widgets.py b/lib/streamlit/elements/time_widgets.py\n--- a/lib/streamlit/elements/time_widgets.py\n+++ b/lib/streamlit/elements/time_widgets.py\n@@ -61,12 +61,7 @@\n         return dg._enqueue(\"time_input\", time_input_proto, current_value)  # type: ignore\n \n     def date_input(\n-        dg,\n-        label,\n-        value=None,\n-        min_value=datetime.min,\n-        max_value=None,\n-        key=None,\n+        dg, label, value=None, min_value=None, max_value=None, key=None,\n     ):\n         \"\"\"Display a date input widget.\n \n@@ -79,7 +74,7 @@\n             0 to 2 date/datetime values is provided, the datepicker will allow\n             users to provide a range. Defaults to today as a single-date picker.\n         min_value : datetime.date or datetime.datetime\n-            The minimum selectable date. Defaults to datetime.min.\n+            The minimum selectable date. Defaults to today-10y.\n         max_value : datetime.date or datetime.datetime\n             The maximum selectable date. Defaults to today+10y.\n         key : str\n@@ -126,6 +121,9 @@\n \n         if isinstance(min_value, datetime):\n             min_value = min_value.date()\n+        elif min_value is None:\n+            today = date.today()\n+            min_value = date(today.year - 10, today.month, today.day)\n \n         date_input_proto.min = date.strftime(min_value, \"%Y/%m/%d\")\n", "issue": "Month dropdown on DateInput is very slow (~5s to appear)\n# Summary\r\n\r\nMonth dropdown on DateInput is very slow (~5s to appear). See https://i.imgur.com/WkmHYag.gifv\r\n\r\n# Steps to reproduce\r\n\r\nWhat are the steps we should take to reproduce the bug:\r\n\r\n1. Create `st.date_input('hi')`\r\n2. Click on the date\r\n3. Click on the month inside the date\r\n\r\n## Expected behavior:\r\n\r\nMonth dropdown should appear almost instantly, with no user-perceived lag.\r\n\r\n## Actual behavior:\r\n\r\nTakes ~5 seconds\r\n\r\n## Is this a regression?\r\n\r\nUnsure. Does this date input dropdown use our virtualized selectbox?\r\n\r\n# Debug info\r\n\r\n- Streamlit version: develop\r\n- Python version: 3.7.6\r\n- Using Pipenv\r\n- OS version: Windows 10\r\n- Browser version: Chrome\r\n\n", "before_files": [{"content": "from datetime import datetime, date, time\n\nfrom streamlit.proto.TimeInput_pb2 import TimeInput as TimeInputProto\nfrom streamlit.proto.DateInput_pb2 import DateInput as DateInputProto\nfrom streamlit.errors import StreamlitAPIException\nfrom .utils import _get_widget_ui_value\n\n\nclass TimeWidgetsMixin:\n    def time_input(dg, label, value=None, key=None):\n        \"\"\"Display a time input widget.\n\n        Parameters\n        ----------\n        label : str\n            A short label explaining to the user what this time input is for.\n        value : datetime.time/datetime.datetime\n            The value of this widget when it first renders. This will be\n            cast to str internally. Defaults to the current time.\n        key : str\n            An optional string to use as the unique key for the widget.\n            If this is omitted, a key will be generated for the widget\n            based on its content. Multiple widgets of the same type may\n            not share the same key.\n\n        Returns\n        -------\n        datetime.time\n            The current value of the time input widget.\n\n        Example\n        -------\n        >>> t = st.time_input('Set an alarm for', datetime.time(8, 45))\n        >>> st.write('Alarm is set for', t)\n\n        \"\"\"\n        # Set value default.\n        if value is None:\n            value = datetime.now().time()\n\n        # Ensure that the value is either datetime/time\n        if not isinstance(value, datetime) and not isinstance(value, time):\n            raise StreamlitAPIException(\n                \"The type of the value should be either datetime or time.\"\n            )\n\n        # Convert datetime to time\n        if isinstance(value, datetime):\n            value = value.time()\n\n        time_input_proto = TimeInputProto()\n        time_input_proto.label = label\n        time_input_proto.default = time.strftime(value, \"%H:%M\")\n\n        ui_value = _get_widget_ui_value(\"time_input\", time_input_proto, user_key=key)\n        current_value = (\n            datetime.strptime(ui_value, \"%H:%M\").time()\n            if ui_value is not None\n            else value\n        )\n        return dg._enqueue(\"time_input\", time_input_proto, current_value)  # type: ignore\n\n    def date_input(\n        dg,\n        label,\n        value=None,\n        min_value=datetime.min,\n        max_value=None,\n        key=None,\n    ):\n        \"\"\"Display a date input widget.\n\n        Parameters\n        ----------\n        label : str\n            A short label explaining to the user what this date input is for.\n        value : datetime.date or datetime.datetime or list/tuple of datetime.date or datetime.datetime or None\n            The value of this widget when it first renders. If a list/tuple with\n            0 to 2 date/datetime values is provided, the datepicker will allow\n            users to provide a range. Defaults to today as a single-date picker.\n        min_value : datetime.date or datetime.datetime\n            The minimum selectable date. Defaults to datetime.min.\n        max_value : datetime.date or datetime.datetime\n            The maximum selectable date. Defaults to today+10y.\n        key : str\n            An optional string to use as the unique key for the widget.\n            If this is omitted, a key will be generated for the widget\n            based on its content. Multiple widgets of the same type may\n            not share the same key.\n\n        Returns\n        -------\n        datetime.date\n            The current value of the date input widget.\n\n        Example\n        -------\n        >>> d = st.date_input(\n        ...     \"When\\'s your birthday\",\n        ...     datetime.date(2019, 7, 6))\n        >>> st.write('Your birthday is:', d)\n\n        \"\"\"\n        # Set value default.\n        if value is None:\n            value = datetime.now().date()\n\n        single_value = isinstance(value, (date, datetime))\n        range_value = isinstance(value, (list, tuple)) and len(value) in (0, 1, 2)\n        if not single_value and not range_value:\n            raise StreamlitAPIException(\n                \"DateInput value should either be an date/datetime or a list/tuple of \"\n                \"0 - 2 date/datetime values\"\n            )\n\n        if single_value:\n            value = [value]\n\n        date_input_proto = DateInputProto()\n        date_input_proto.is_range = range_value\n\n        value = [v.date() if isinstance(v, datetime) else v for v in value]\n\n        date_input_proto.label = label\n        date_input_proto.default[:] = [date.strftime(v, \"%Y/%m/%d\") for v in value]\n\n        if isinstance(min_value, datetime):\n            min_value = min_value.date()\n\n        date_input_proto.min = date.strftime(min_value, \"%Y/%m/%d\")\n\n        if max_value is None:\n            today = date.today()\n            max_value = date(today.year + 10, today.month, today.day)\n\n        if isinstance(max_value, datetime):\n            max_value = max_value.date()\n\n        date_input_proto.max = date.strftime(max_value, \"%Y/%m/%d\")\n\n        ui_value = _get_widget_ui_value(\"date_input\", date_input_proto, user_key=key)\n\n        if ui_value is not None:\n            value = getattr(ui_value, \"data\")\n            value = [datetime.strptime(v, \"%Y/%m/%d\").date() for v in value]\n\n        return_value = value[0] if single_value else tuple(value)\n        return dg._enqueue(\"date_input\", date_input_proto, return_value)  # type: ignore\n", "path": "lib/streamlit/elements/time_widgets.py"}], "after_files": [{"content": "from datetime import datetime, date, time\n\nfrom streamlit.proto.TimeInput_pb2 import TimeInput as TimeInputProto\nfrom streamlit.proto.DateInput_pb2 import DateInput as DateInputProto\nfrom streamlit.errors import StreamlitAPIException\nfrom .utils import _get_widget_ui_value\n\n\nclass TimeWidgetsMixin:\n    def time_input(dg, label, value=None, key=None):\n        \"\"\"Display a time input widget.\n\n        Parameters\n        ----------\n        label : str\n            A short label explaining to the user what this time input is for.\n        value : datetime.time/datetime.datetime\n            The value of this widget when it first renders. This will be\n            cast to str internally. Defaults to the current time.\n        key : str\n            An optional string to use as the unique key for the widget.\n            If this is omitted, a key will be generated for the widget\n            based on its content. Multiple widgets of the same type may\n            not share the same key.\n\n        Returns\n        -------\n        datetime.time\n            The current value of the time input widget.\n\n        Example\n        -------\n        >>> t = st.time_input('Set an alarm for', datetime.time(8, 45))\n        >>> st.write('Alarm is set for', t)\n\n        \"\"\"\n        # Set value default.\n        if value is None:\n            value = datetime.now().time()\n\n        # Ensure that the value is either datetime/time\n        if not isinstance(value, datetime) and not isinstance(value, time):\n            raise StreamlitAPIException(\n                \"The type of the value should be either datetime or time.\"\n            )\n\n        # Convert datetime to time\n        if isinstance(value, datetime):\n            value = value.time()\n\n        time_input_proto = TimeInputProto()\n        time_input_proto.label = label\n        time_input_proto.default = time.strftime(value, \"%H:%M\")\n\n        ui_value = _get_widget_ui_value(\"time_input\", time_input_proto, user_key=key)\n        current_value = (\n            datetime.strptime(ui_value, \"%H:%M\").time()\n            if ui_value is not None\n            else value\n        )\n        return dg._enqueue(\"time_input\", time_input_proto, current_value)  # type: ignore\n\n    def date_input(\n        dg, label, value=None, min_value=None, max_value=None, key=None,\n    ):\n        \"\"\"Display a date input widget.\n\n        Parameters\n        ----------\n        label : str\n            A short label explaining to the user what this date input is for.\n        value : datetime.date or datetime.datetime or list/tuple of datetime.date or datetime.datetime or None\n            The value of this widget when it first renders. If a list/tuple with\n            0 to 2 date/datetime values is provided, the datepicker will allow\n            users to provide a range. Defaults to today as a single-date picker.\n        min_value : datetime.date or datetime.datetime\n            The minimum selectable date. Defaults to today-10y.\n        max_value : datetime.date or datetime.datetime\n            The maximum selectable date. Defaults to today+10y.\n        key : str\n            An optional string to use as the unique key for the widget.\n            If this is omitted, a key will be generated for the widget\n            based on its content. Multiple widgets of the same type may\n            not share the same key.\n\n        Returns\n        -------\n        datetime.date\n            The current value of the date input widget.\n\n        Example\n        -------\n        >>> d = st.date_input(\n        ...     \"When\\'s your birthday\",\n        ...     datetime.date(2019, 7, 6))\n        >>> st.write('Your birthday is:', d)\n\n        \"\"\"\n        # Set value default.\n        if value is None:\n            value = datetime.now().date()\n\n        single_value = isinstance(value, (date, datetime))\n        range_value = isinstance(value, (list, tuple)) and len(value) in (0, 1, 2)\n        if not single_value and not range_value:\n            raise StreamlitAPIException(\n                \"DateInput value should either be an date/datetime or a list/tuple of \"\n                \"0 - 2 date/datetime values\"\n            )\n\n        if single_value:\n            value = [value]\n\n        date_input_proto = DateInputProto()\n        date_input_proto.is_range = range_value\n\n        value = [v.date() if isinstance(v, datetime) else v for v in value]\n\n        date_input_proto.label = label\n        date_input_proto.default[:] = [date.strftime(v, \"%Y/%m/%d\") for v in value]\n\n        if isinstance(min_value, datetime):\n            min_value = min_value.date()\n        elif min_value is None:\n            today = date.today()\n            min_value = date(today.year - 10, today.month, today.day)\n\n        date_input_proto.min = date.strftime(min_value, \"%Y/%m/%d\")\n\n        if max_value is None:\n            today = date.today()\n            max_value = date(today.year + 10, today.month, today.day)\n\n        if isinstance(max_value, datetime):\n            max_value = max_value.date()\n\n        date_input_proto.max = date.strftime(max_value, \"%Y/%m/%d\")\n\n        ui_value = _get_widget_ui_value(\"date_input\", date_input_proto, user_key=key)\n\n        if ui_value is not None:\n            value = getattr(ui_value, \"data\")\n            value = [datetime.strptime(v, \"%Y/%m/%d\").date() for v in value]\n\n        return_value = value[0] if single_value else tuple(value)\n        return dg._enqueue(\"date_input\", date_input_proto, return_value)  # type: ignore\n", "path": "lib/streamlit/elements/time_widgets.py"}]}