-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
bugissue that does not match design or documentation and requires code changes to addressissue that does not match design or documentation and requires code changes to address
Description
Using the DateInput component in an uncontrolled form, does not reset the UI (but the value) on reset of the form.
Expected Behavior
After form reset event the DateInput should show the placeholder or format again (same as if value is undefined). The value is set correctly to undefined.
Actual Behavior
Date is still displayed instead of placeholder or format and value is undefined as expected.
URL, screen shot, or Codepen exhibiting the issue
<Form
onChange={(value) => {console.log(JSON.stringify(value))}}
>
<DateInput
format="mm/dd/yyyy"
name="date"
/>
<TextInput name="text" />
<Button label="clear" type="reset" />
</Form>
I just wrote the code in the DateInput documentation. https://v2.grommet.io/dateinput
You can just copy it there.
Steps to Reproduce
- Open a console, because output will be logged there.
- Select a date in the date picker
- Write a text in the TextInput
- Check the console, you will see the form value like:
- {"date":"2023-05-16T22:00:00.000Z"}
- {"date":"2023-05-16T22:00:00.000Z","text":"123"}
- Now click the reset button
- Check the console, it will show an empty object: {}
- TextInput will be empty, but DateInput still shows the date.
Your Environment
- Grommet version: "^2.29.0",
- Browser Name and version: Firefox 113.0.2 (64-bit) (Windows), but also occurs for colleauges
- Operating System and version (desktop or mobile): Desktop
Metadata
Metadata
Assignees
Labels
bugissue that does not match design or documentation and requires code changes to addressissue that does not match design or documentation and requires code changes to address