Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BaDk23 opened this issue Jun 14, 2024 · 0 comments
Open

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

BaDk23 opened this issue Jun 14, 2024 · 0 comments

Comments

@BaDk23
Copy link

BaDk23 commented Jun 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant