react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

DateTimeInput or DateInput reinitialise when typing a date starting with '0' - only on Firefox

Open guilbill opened this issue 2 years ago • 1 comments

Note: Only noticed on firefox.

What you were expecting:

I have a DateTimeInput field with a date 10/01/1985 10:20: image

I select the field and type "01". The date is now 01/01/1985 10:20

What happened instead:

The field is reinitialized as soon as I type the '0' image

Steps to reproduce:

Go to https://react-admin-storybook.vercel.app/?path=/story/ra-ui-materialui-input-datetimeinput--basic Type a valid date. Now focus the beginning of the field, and type '0' (as if you want to type '01' for exemple)

Related code:

The basic stackblitz is enough to reproduce. https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple On firefox : Edit a Post > Miscellanous > Edit a date input by starting by a '0'

<DateTimeInput source='foo'/>

Other information:

I first though of a behaviour of the html input on firefox. But trying it directly : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local I did not reproduce the same behaviour.

Environment

  • React-admin version: "4.13.2"
  • React version: "18.2.0"
  • Browser: Firefox 118.0.1 (64 bits)

guilbill avatar Oct 04 '23 13:10 guilbill

Reproduced, thanks!

slax57 avatar Oct 05 '23 08:10 slax57