vippuhi
vippuhi

Reputation: 21

Disable past hour in Material UI DateTimePicker

Is there any way I can disable selecting the past hour in DateTimePicker https://material-ui-pickers.dev/api/DateTimePicker I am using disablePast but seems like it is disabling the past dates but you can select past hour for current date.

Appreciate the help.

Upvotes: 2

Views: 5654

Answers (2)

Hafiz Temuri
Hafiz Temuri

Reputation: 4142

If anyone else comes across this and wondering how to resolve this issue, try using,

disableIgnoringDatePartForTimeValidation={true}

Not sure when this flag was added, but I am using "@mui/x-date-pickers": "^6.0.4"

Upvotes: 1

Giovanni Esposito
Giovanni Esposito

Reputation: 11176

Ciao, yes you are right, on DateTimePicker there is disablePast to disable past dates but not past time. Look this, someone asked to add minTime prop in DateTimePicker to disable past time but there isn't any update on this topic.

The only thing you can do is validate time by yourself like this guy have done.

Upvotes: 3

Related Questions