mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.14k stars 1.29k forks source link

[pickers][DateTimeRangePicker] Manually selecting the date then selecting the time in the popover reverts the date to today #13904

Open simjoeweb opened 3 months ago

simjoeweb commented 3 months ago

Steps to reproduce

Link to live example: (required)

It can be reproduced on the official website, for any DateTimeRangePicker.

Current behavior

Steps:

  1. Click on the DateTimeRangerPicker's start date field.
  2. Manually enter (with keyboard): the month, date and year.
  3. Click to select a time in the popup.

The date you manually entered is now today's date.

Expected behavior

It should keep the date you manually entered.

Context

No response

Your environment

npx @mui/envinfo ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: date time range picker bug

michelengelen commented 3 months ago

Hey @simjoeweb and thanks for raising this. I can confirm the bug and will add this to the board for the team to have a look!

arthurbalduini commented 2 months ago

I suspect this behavior occurs because, at the moment the focus shifts to the digital clock view, the current value is something like 01 02 2024 hh mm aa, an invalid value. As a result, it falls back to the current date, which is the expected behavior. Notice that the behavior is the same if you select a time in the popup with empty date values. Also the opposite case: by setting time values from the field and then date values from the calendar, it will ignore the inputed value and use its default Since we can't parse date and time separately, we must have default values to cover those cases.

gabgagnon commented 6 days ago

@michelengelen Hey Michel! Any news on this? It this an expected behavior or this is considered a bug?