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

[pickers][DateTimeRangePicker] Issue with setting initial time values #15405

Closed
JessArschoot opened this issue Nov 13, 2024 · 3 comments · Fixed by #15429
Closed

[pickers][DateTimeRangePicker] Issue with setting initial time values #15405

JessArschoot opened this issue Nov 13, 2024 · 3 comments · Fixed by #15429
Assignees
Labels
bug 🐛 Something doesn't work component: DateTimeRangePicker The React component component: pickers This is the name of the generic UI component, not the React module! support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@JessArschoot
Copy link

JessArschoot commented Nov 13, 2024

Steps to reproduce

Steps:

  1. I have an DateTimeRangePicker with property referenceDate
    • moment().hour(8).minute(0) .second(0)
  2. When selecting the first date, time selection is giving me 00:00:00

Current behavior

When I select the start date, the initial time is 00:00.

Expected behavior

The initial time should be 08:00

Context

I am working on a form that defines the work schedule for an employee using the MUI DateTime Range Picker. Typically, employees have fixed working hours, so we’d like to set default start and end times (e.g., 8:00 AM and 5:00 PM) when the date range is selected. However, we currently cannot set initial time values using the referenceDate prop.

Expected Behavior:

Ideally, I’d like to be able to specify default time values for the start and end of the date range. For instance:

Start Date: default time set to 8:00 AM.
End Date: default time set to 5:00 PM.
These defaults would pre-fill as initial times when the user selects a date range, reducing repetitive inputs. However, adjusting these initial times through the referenceDate prop is currently unsupported.

Your environment

No response

Search keywords: DateTimeRangePicker referenceDate
Order ID: 89609

@JessArschoot JessArschoot added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 13, 2024
@github-actions github-actions bot added component: pickers This is the name of the generic UI component, not the React module! support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/ labels Nov 13, 2024
@michelengelen
Copy link
Member

To help us diagnose the issue efficiently, could you provide a stripped-down reproduction test case using the latest version? A live example would be fantastic! ✨

For your convenience, our documentation offers templates and guides on creating targeted examples: Support - Bug reproduction

Just a friendly reminder: clean, functional code with minimal dependencies is most helpful. Complex code can make it tougher to pinpoint the exact issue. Sometimes, simply going through the process of creating a minimal reproduction can even clarify the problem itself!

Thanks for your understanding! 🙇🏼

@michelengelen michelengelen added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 14, 2024
@michelengelen michelengelen changed the title Issue with setting initial time values in MUI DateTimeRangePicker [pickers][DateTimeRangePicker] Issue with setting initial time values Nov 14, 2024
@LukasTy
Copy link
Member

LukasTy commented Nov 14, 2024

Hello @JessArschoot, thank you for raising this issue. 🙏
DateTimeRangePicker looks like an outlier when comparing the referenceDate behavior between different components.

Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@JessArschoot 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: DateTimeRangePicker The React component component: pickers This is the name of the generic UI component, not the React module! support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants