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

[DateRangePicker] Allow same date selection #23701

Merged

Conversation

hmaddisb
Copy link
Contributor

@hmaddisb hmaddisb commented Nov 24, 2020

The test is the first one I have written for MUI. The test checks that a range of one day is accepted.

I hope I introduced the new test according to your conventions. Feedback is of course appreciated!

Fixes #23603
Fixes mui/material-ui-pickers#1759

@mui-pr-bot
Copy link

mui-pr-bot commented Nov 24, 2020

@material-ui/core: parsed: +Infinity% , gzip: +Infinity%
@material-ui/lab: parsed: +Infinity% , gzip: +Infinity%
@material-ui/styles: parsed: +Infinity% , gzip: +Infinity%
@material-ui/system: parsed: +Infinity% , gzip: +Infinity%
@material-ui/utils: parsed: +Infinity% , gzip: +Infinity%

Details of bundle changes

Generated by 🚫 dangerJS against 6a91ab2

@oliviertassinari oliviertassinari added component: date range picker This is the name of the generic UI component, not the React module! bug 🐛 Something doesn't work labels Nov 24, 2020
@oliviertassinari oliviertassinari force-pushed the daterangepicker-same-date-selection branch from 1f444e0 to bb59e1d Compare November 25, 2020 00:06
Comment on lines +64 to +71
<DesktopDateRangePicker
renderInput={defaultRangeRenderInput}
onChange={() => {}}
value={[
adapterToUse.date('2018-01-01T00:00:00.000'),
adapterToUse.date('2018-01-01T00:00:00.000'),
]}
/>,
Copy link
Member

Choose a reason for hiding this comment

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

I was sceptic that we should allow this by default but then realized it is behind a flag (allowSameDateSelection prop).

However, the test makes it seem like either it is default behavior or allowSameDateSelection is not working.

If you expect a range as an input that you usually don't expect a single date. I've worked on some internal tools for car-rentals in the past and they had the notion of "minimum range" which would make more sense here. Though it looks like DateRangePicker doesn't implement such a feature?

Copy link
Member

Choose a reason for hiding this comment

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

I believe:

Copy link
Member

Choose a reason for hiding this comment

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

Might be possible with existing API. I haven't looked so far. Still scratching the surface and ironing out kinks from the forceful integration.

@oliviertassinari oliviertassinari merged commit 1e305ec into mui:next Nov 27, 2020
@oliviertassinari
Copy link
Member

@hmaddisb Thanks for spending time on it

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: date range picker This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DateRangePicker] Allow same date selection Add ability to select same date in date range picker
4 participants