Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

[Date] onChange not triggered when the input value is removed #1193

@BaDk23

Description

@BaDk23

Issue and Steps to Reproduce

The component has not the same behaviour as <input type="date />.
onChange is not triggered when value is removed by the user.

To reproduce :

const MaDate = () => {
  const [maDate, setMaDate] = useState("");

  return <>
    <DateInput
      value={maDate}
      onChange={(e: any) => {
        console.log(e.value)
        setMaDate(e.value)
      }}
      label="MaDate"
    />
  </>
}

image
It works as expected when filling the input

image
Now when the user empty the input (partially 15/mm/2024 or fully jj/mm/aaaa), nothing is logged in the console, onChange is not triggered and the value of the state is not updated

This is a problem, if this date input is controlled with a state, the state value will be different from what the user has set

Versions

2.3.1

Expected

Like the <input type="date />, we see console logging an empty string
image

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