Skip to content

[pickers] Add TimeRangePicker component#9431

Merged
LukasTy merged 136 commits into
mui:masterfrom
flaviendelangle:time-range-picker
Mar 11, 2025
Merged

[pickers] Add TimeRangePicker component#9431
LukasTy merged 136 commits into
mui:masterfrom
flaviendelangle:time-range-picker

Conversation

@flaviendelangle

@flaviendelangle flaviendelangle commented Jun 23, 2023

Copy link
Copy Markdown
Member

Doc preview
Closes #4460

Follow ups:

@flaviendelangle flaviendelangle added the scope: pickers Changes related to the date/time pickers. label Jun 23, 2023
@flaviendelangle flaviendelangle self-assigned this Jun 23, 2023
@mui-bot

mui-bot commented Jun 23, 2023

Copy link
Copy Markdown

Localization writing tips ✍️

Seems you are updating localization 🌍 files.

Thank you for contributing to the localization! 🎉 To make your PR perfect, here is a list of elements to check: ✔️

  • Verify if the PR title respects the release format. Here are two examples (depending if you update or add a locale file)

    [l10n] Improve Swedish (sv-SE) locale
    [l10n] Add Danish (da-DK) locale

  • Update the documentation of supported locales by running pnpm l10n
  • Clean files with pnpm prettier.

Deploy preview: https://deploy-preview-9431--material-ui-x.netlify.app/

Updated pages:

Generated by 🚫 dangerJS against 59bbc64

@LukasTy LukasTy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving some minor observations here. 🙈

Comment thread docs/data/date-pickers-component-api-pages.ts Outdated
Comment thread packages/x-date-pickers-pro/src/index.ts
Comment thread packages/x-date-pickers-pro/src/TimeRangePicker/shared.tsx Outdated

const props = {
...defaultizedProps,
// TODO: Do we want the toolbar to support AM/PM switch on mobile?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably no, unless we go with the AnalogClock on Mobile. 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the plan is to have the digital clock on mobile for range pickers and the analog clock on mobile for TimePicker / DateTimePicker ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we'd go with the proposed designs - it would seem so, but that is still up for debate. 🙈

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the component ready for mobile?

I'm 100% in favor of doing it. But if we do it, for me it means that in the future we will use the digital clock on the MobileTimePicker.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the component ready for mobile?

It had some issues, which I tried addressing in the DateTimeRangePicker PR.

I'm 100% in favor of doing it. But if we do it, for me it means that in the future we will use the digital clock on the MobileTimePicker.

That part we still need to align on the Design and Product side. I'm also for consistency, but we currently do not seem to have a singular position that everyone agrees on. 🙈

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can focus our next Monday meeting on this topic 👌

Concerning the rendererInterceptor, it's not easy to understand what is the goal but I'll wait to have the JSDoc to have a 2nd look 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can focus our next Monday meeting on this topic 👌

Oh yes, that's one of the last pressing design matters for the range pickers.

Concerning the rendererInterceptor, it's not easy to understand what is the goal but I'll wait to have the JSDoc to have a 2nd look 👍

Don't pay too much attention to it. That was my alpha implementation for configurable view renderer support and handling view combination (DateRangeCalendar on the left and MultiSectionDigitalClock or any other timeViewRenderer on the right).

Comment thread packages/x-date-pickers-pro/src/DesktopTimeRangePicker/DesktopTimeRangePicker.tsx Outdated
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Sep 16, 2023
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Sep 26, 2023
@github-actions

github-actions Bot commented Mar 7, 2025

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 7, 2025
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 10, 2025
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 10, 2025
@noraleonte

Copy link
Copy Markdown
Contributor

Great effort! 🚀 💙 Nice to see this component shaping up 💪
I didn't dive deep into the code, but I'm leaving a few comments for the design/behavior:

It's a bit hard to tell the difference between the start time picker and the end time picker. I'm can't remember exactly if we said we would implement the highlighting in a follow-up 🤔 I think we should consider implementing the highlighting design at least partially to make the switch between start and end pickers more visible.
https://github.com/user-attachments/assets/cc6970bf-131f-449c-b767-cc031baa1d00

The picker that opens depends on the value you filled out last. i.e. You fill out start time, fill out end time but don't click 'ok' or select the meridiem, the next time you open the picker, it opens on the end time and you can't select the start value unless you interact with the end value again. It can become a bit confusing for the user. This is sort of related to my comment from above: if there is a clear visual distinction the opening behavior might not be such a problem. I propose we standardize the opening behavior though... WDYT about this: clicking the open picker button always opens the start time? 🤔 Still not perfect, but maybe less confusing?
https://github.com/user-attachments/assets/18c6ca43-860b-4310-ac84-ba74ee60d2c4

There's a bit of a layout shift between the start and end time pickers due to the difference of width. Would making the start and end pickers width equal be a big hassle? 🤔
https://github.com/user-attachments/assets/82a53770-b5e2-4ac0-b7be-33ca619c274d

Would it be possible to position the picker under its input when using multi input fields?
Screenshot 2025-03-10 145002

@LukasTy

LukasTy commented Mar 10, 2025

Copy link
Copy Markdown
Member

Great effort! 🚀 💙 Nice to see this component shaping up 💪

Thank you for the feedback @noraleonte. 🙏

I think we should consider implementing the highlighting design at least partially to make the switch between start and end pickers more visible.

I completely agree that the current process is not great.
Your mentioned solution is planned for a follow-up, as mentioned in the description. 😉
I did not want to bloat the PR further with any TRP specific implementation.

WDYT about this: clicking the open picker button always opens the start time? 🤔 Still not perfect, but maybe less confusing?

The views or range position management has not been altered in the PR.
The process/situation is the same as for Date Range Picker.
Technically, it's also unclear what you are currently selecting on that component. 🙈
I think the highlighting should improve clarity in this regard. 😉

Would it be possible to position the picker under its input when using multi input fields?

Yes, it will be done. It's also planned for a follow-up. 😉

There's a bit of a layout shift between the start and end time pickers due to the difference of width. Would making the start and end pickers width equal be a big hassle? 🤔

Are you suggesting adding a minWidth on that demo? 🤔
EDIT: I added (fc8e76a) a minimum width to avoid the mentioned layout shift. 😉

@noraleonte

Copy link
Copy Markdown
Contributor

Your mentioned solution is planned for a follow-up, as mentioned in the description.

Ooh, I completely missed that, sorry 🙈

The views or range position management has not been altered in the PR.
The process/situation is the same as for Date Range Picker.
Technically, it's also unclear what you are currently selecting on that component.

True, 100% agree 🤔 Highlighting will certainly help. We can treat this as a separate UX issue since it also impacts the other pickers. TRP might be in a bit of a special situation because you don't have a visual indicator of the range inside the view. For the date range you have the range highlighting so it's less confusing.

Yes, it will be done. It's also planned for a follow-up.

Nice, thanks 😄

EDIT: I added (fc8e76a) a minimum width to avoid the mentioned layout shift.

Awesome 🎉

@flaviendelangle

Copy link
Copy Markdown
Member Author

I cannot approve 😢
@LukasTy feel free to approve and merge whenever you want.

@noraleonte noraleonte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pushing this forward 🚀 great work 💙

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 11, 2025
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plan: Pro Impact at least one Pro user. scope: pickers Changes related to the date/time pickers. type: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pickers] New component: TimeRangePicker

4 participants