Skip to content
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

Selecting minutes from clock breaks the DateTimePicker with format prop passed as "MM/DD/YYYY HH:mm" #12034

Closed
dhruvmaindola227 opened this issue Feb 11, 2024 · 2 comments
Labels
component: pickers This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information support: question Community support but can be turned into an improvement

Comments

@dhruvmaindola227
Copy link

dhruvmaindola227 commented Feb 11, 2024

Steps to reproduce

https://stackblitz.com/edit/react-wdgpib?file=Demo.tsx

Demo link

Steps:

  1. use viewRenderers
  2. pass format prop as MM/DD/YYYY HH:mm (breaking even for hh:mm)
  3. select minutes from the clock

image

Current behavior

Upon selecting minutes from the clock, the DateTimePicker breaks saying cannot read properties of undefined 'contentType'.
I tried with various formats. HH:mm:ss/ HH:mm/hh:mm/hh:mm:ss.

I tried with hh:mm a, then it works normally. I can tell there might be some usage issue on my end in this case. If anyone can guide me on this and why this is happening it will be of really a lot of help.

Expected behavior

No response

Context

I had written a wrapper over the DateTimePicker and there was this use case to support 24 hour format but it was breaking.

Your environment

date pickers version : 6.19.4

Search keywords: minute selection, datetimepicker, format, contentType

@dhruvmaindola227 dhruvmaindola227 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 11, 2024
@LukasTy
Copy link
Member

LukasTy commented Feb 12, 2024

Thank you for creating this issue @dhruvmaindola227 🙏
Based on your approach, you seem to need a DateTimePicker with a 24-hour clock.
To force such behavior and avoid it depending on the user's locale, please set ampm={false}.
You include ss in the format, maybe you want the seconds view as well?
If that's the case, feel free to override the default views prop.

views={['day', 'hours', 'minutes', 'seconds']}

Does that help you resolve your use case? 🤔

@LukasTy LukasTy added support: question Community support but can be turned into an improvement status: waiting for author Issue with insufficient information component: pickers This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 12, 2024
Copy link

The issue has been inactive for 7 days and has been automatically closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

2 participants