Thursday 30 December 2021

how to disable future time in material-ui KeyboardDateTimePicker in reactjs

I'm using Material UI KeyboardDateTimePicker and by using disabledFuture I was able to disable future date but I want to disable future time as well. any solution would be appreciated

import { KeyboardDateTimePicker } from "@material-ui/pickers";
 <KeyboardDateTimePicker
            color="primary"
            disableFuture
            format="yyyy-MM-dd hh:mm a"
            label={intl.formatMessage({ id: "end" })}
            margin="normal"
            onChange={(x) => onChange({ from, to: x?.toJSDate() ?? null })} 
            value={to}
            variant="inline"
            maxDate={new Date()}
          />

Note - i don't want to update library



from how to disable future time in material-ui KeyboardDateTimePicker in reactjs

No comments:

Post a Comment