In the React MUI Datepicker, how do I remove extra 0, for a Single Hour time?
Right now, its showing an extra 0 here.
Goal is following, 03:00 PM --> 3:00 PM
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DateTimePickerStyled
format="MMM DD, YYYY h:mm A"
/>
</LocalizationProvider>
asked Aug 12, 2025 at 19:17
mattsmith5
1,3577 gold badges58 silver badges114 bronze badges
1 Answer 1
MUI docs. They require the "shouldRespectLeadingZeros" prop even when supplying a custom format, according to them. Try this:
<DateTimePicker
label="Formatted Picker"
slotProps={{ field: { shouldRespectLeadingZeros: true } }}
format="MMM DD, YYYY h:mm A"
/>
This worked for me in a codesandbox.
Sign up to request clarification or add additional context in comments.
Comments
Explore related questions
See similar questions with these tags.
lang-js