-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Setting DatePicker format to DD MMM YYYY but deleting the MMM will make the textfield shows MMMM (Long Month format) #8526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's the expected behavior. When a section is empty, it shows a placeholder which is not necessarily the format token. Here for month, the default is 4 letters for words and 2 letters for numbers
You can modify this behavior by providing custom // Field section placeholders
fieldYearPlaceholder: (params) => 'Y'.repeat(params.digitAmount),
fieldMonthPlaceholder: (params) => (params.contentType === 'letter' ? 'MMMM' : 'MM'),
fieldDayPlaceholder: () => 'DD',
fieldWeekDayPlaceholder: (params) => (params.contentType === 'letter' ? 'EEEE' : 'EE'),
fieldHoursPlaceholder: () => 'hh',
fieldMinutesPlaceholder: () => 'mm',
fieldSecondsPlaceholder: () => 'ss',
fieldMeridiemPlaceholder: () => 'aa', This information could be added in the base concept pages |
Thanks Alex for the input, it works now. |
@flaviendelangle What do you think about?
|
They are documented here I think it's too specific to be in the Base concept |
Any ideas on how to use the |
You have the answer just above 👍 And for a more in-depth explanation on how to pass locales to the grid: https://mui.com/x/react-date-pickers/localization/ |
@flaviendelangle I agree with @AkshayHere, could you please provide an example of how this can be used? |
@LukasTy Thanks, just checked checked this, and this worked for me: Changing the fieldMonthPlaceholder as shown in the example to get the correct format: |
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example:
Steps:
Current behavior 😯
Expected behavior 🤔
No response
Context 🔦
No response
Your environment 🌎
npx @mui/envinfo
Order ID or Support key 💳 (optional)
No response
The text was updated successfully, but these errors were encountered: