Skip to content

Empty input_date() crashes Shiny #1528

@gadenbuie

Description

@gadenbuie

Reproducible on shinylive as of 2024-07-15.

from shiny.express import ui

ui.markdown(
    """
    ## Reprex
    
    Delete all of the text in the date input below.
    The app will crash.
    """
)

ui.input_date("date1", "Date:", value="2016-02-29")

results in this error:

Traceback (most recent call last):
  File "/lib/python3.12/site-packages/shiny/session/_session.py", line 644, in _run
    self._manage_inputs(message_obj["data"])
  File "/lib/python3.12/site-packages/shiny/session/_session.py", line 690, in _manage_inputs
    val = input_handlers._process_value(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/shiny/input_handler.py", line 41, in _process_value
    return handler(value, name, session)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/shiny/input_handler.py", line 108, in _
    _safe_strptime_date(value[0]),
                        ~~~~~^^^
TypeError: 'NoneType' object is not subscriptable
'NoneType' object is not subscriptable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions