Fix #3385: Add support for 'time' and 'datetime-local' input types to dcc.Input #3454
+165
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3385 by adding support for
'time'
and'datetime-local'
input types to thedcc.Input
component's PropTypes definition.Problem
As reported in #3385, when creating a valid
dcc.Input
with time-based input types:PyCharm showed type warnings:
Expected type 'Literal["text", "number", "password", "email", "range", "search", "tel", "url", "hidden"] | None', got 'Literal['time']' instead
Root Cause
The PropTypes.oneOf array in
components/dash-core-components/src/components/Input.react.js
was missing these two HTML5 input types, even though they have wide modern browser support.Solution
Organized Commits:
Following the contributor guidelines, changes are organized in logical commits:
Add support for 'time' and 'datetime-local' input types (
a31ea469
)Update integration tests for new input types (
6b056ea9
)Add comprehensive tests for time and datetime-local inputs (
af006f02
)Changes Made:
Input.react.js
: Added'time'
and'datetime-local'
to PropTypes.oneOf arraytest_input_basics.py
: Updated ALLOWED_TYPES and enhanced test logictest_time_datetime_inputs.py
: New comprehensive test suiteContributor Checklist