-
Notifications
You must be signed in to change notification settings - Fork 9
Description
While I'm able to control the initial state of the TextField, when I activate the DateTimePicker, the picker that's displayed, still always defaults to Date.now().
It appears this was similar to the issue here for TimePicker: #15
You can see the behavior here: https://codesandbox.io/s/rrrvp0ljkn
If you click the first picker area, the DatePicker displayed gives you the correct date. But if you click on the DateTimePicker element, you get the current date.
AFAICT, the problem lies in the fact that the interface to DateTimePicker only allows for setting the value prop. While DatePicker has a value prop that can control the date for it, the DatePickerDialog does NOT have the value prop, but instead uses the initialDate prop, to then set the underlying value prop on it's DatePicker: https://github.com/mui-org/material-ui/blob/master/src/DatePicker/DatePickerDialog.js#L22