-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[pickers][DateTimePicker] Using renderDigitalClockTimeView
causes console errors
#15723
Comments
Hey @KealJones ... you did pass the You need to remove it from the <DateTimePicker
label="Basic date time picker"
- views={['year', 'month', 'day', 'hours', 'minutes']}
+ views={['year', 'month', 'day', 'hours']}
viewRenderers={{
hours: ({ views, focusedView, ...rest }) =>
renderDigitalClockTimeView({
...rest,
views: ['hours'],
focusedView: 'hours',
}),
minutes: null,
seconds: null,
}}
/> |
renderDigitalClockTimeView
with DateTimePicker causes console errorsrenderDigitalClockTimeView
causes console errors
@michelengelen hey thanks for the reply. Your suggestion was actually what tried first but it makes the Field only show the hours. Hence why my workaround was to wrap renderDigitalClockTimeView and override the views and focusedView props, so that the field can still show everything but the errors would go away, I'm not sure where the common usage of renderDigitalClockTimeView is but the error seems like it would happen in most usages, maybe? Also, i realized just now that the link i put for the reproduction url was actually the workaround i had made, so here is a working reproduction, select the date/time with the dropdown picker to see the errors: https://stackblitz.com/edit/react-tlhhey-km5fcz?file=Demo.tsx ill update the main issue link as well. |
You can use the format="DD/MM/YYYY hh:mm a" |
@michelengelen Although that does work when combined with the views excluding minutes that unfortunately prevents date format localization via the LocalizationProvider from being applied. so it's a no go as we need date format localization to work. |
My workaround works just fine, I mainly brought this up as an issue because I was just curious if maybe the workaround i suggested or something like it should actually be part of thought of a small adjustment for the workaround: |
woops just realized i posted those with my work account, my bad those above are me. |
I just discovered that you can use |
Ah, right ... if that works for you it's great. I'll close this issue then! 👍🏼 |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @KealJones How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Steps to reproduce
Steps:
Failed prop type: Invalid prop `views[1]` of value `minutes` supplied to `ForwardRef(DigitalClock)`, expected one of ["hours"]
Adjusting the default props
views
to just behours
removes the minutes and meridian.Current behavior
throws console error
Expected behavior
shouldnt throw console error.
Context
i am trying to use a
DigitalClock
forDateTimePicker
instead ofMultiSectionDigitalClock
.The only work around to not get an error i could find was:
(as default props in theme)
or (same but for in jsx prop)
link to workaround: https://stackblitz.com/edit/react-tlhhey?file=Demo.tsx
Your environment
npx @mui/envinfo
Search keywords: renderDigitalClockTimeView, DigitalClock, DateTimePicker, viewRenderers, views, focusedView
The text was updated successfully, but these errors were encountered: