Currently using a Timepicker
from material-ui. I have it set to type="time"
which allows me to select through times during the day in 12 hours with a AM / PM option. I would like to have my picker with a 24-hour format which would remove the AM/PM option. I've looked in the material-ui documentation and could not find anything that could handle this.
Sandbox
Current code:
<form className={classes.container} noValidate>
<TextField
id="time"
label="Alarm clock"
type="time"
className={classes.textField}
InputLabelProps={{
shrink: true
}}
inputProps={{
step: 900 // 5 min
}}
/>
</form>
They seem to be reccomending using @material-ui/pickers
https://material-ui-pickers.dev/api/TimePicker
import { TimePicker } from '@material-ui/pickers'
the following option should do it for you
ampm={false}
<TimePicker
clearable
ampm={false}
label="24 hours"
value={selectedDate}
onChange={handleDateChange}
/>
If you need to use the native picker check out this post HTML input time in 24 format
If you use Material UI
import DateTimePicker from '@mui/lab/DateTimePicker';
<DateTimePicker
label="Дуусах өдөр"
value={dateValue}
ampm={false} // use this row
onChange={handleChangeDate}
renderInput={(params) => <TextField {...params} />}
/>
But we need to avoid @mui/labs
components
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With