1

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>

enter image description here

asked Aug 12, 2025 at 19:17

1 Answer 1

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.

answered Aug 12, 2025 at 20:31
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.