mui/material-ui-pickers

[v4] KeyboardDatePickers returning different time on keyboard input and touch click

Paul6552 opened this issue · 1 comments

KeyboardDatePickers is returning a different time when you do it via keyboard or with touch click.

  • [x ] The issue is present in the latest release.
  • [x ] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Hours, minutes and seconds are different if I am typing the date with the keyboard or I am doing over touch with the symbol

Expected Behavior 🤔

Keyboard input and touch input should be the same. Hours, seconds to zero

Steps to Reproduce 🕹

Codesandbox example

Steps:

  1. Type in a new Date with keyboard input
  2. See in the console for the date. Seconds, hours have a time
  3. Type in a new Date with the touch symbol, without keyboard, only with mouse
  4. See in the console for the date. Seconds hours are now zero.

image

Your Environment 🌎

react 17.02
material-ui v4.11.4

Workaround:
date.setHours(2); date.setSeconds(0); date.setMilliseconds(0);