-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] Improve the behaviors when the end date is filled before the start date #12177
base: master
Are you sure you want to change the base?
Conversation
if (allowRangeFlip) { | ||
response = { nextSelection: 'start', newRange: [end!, selectedDate] }; | ||
} else { | ||
response = { nextSelection: 'start', newRange: [null, selectedDate] }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reworked this method to avoid computing truthyResult
if it's not needed.
And I did one behavior change here.
Now, if you have a date with only an end date filled, and you click on a date after the end date, you just change the end date and keep editing the start date.
This is more consistent with the mirror scenario for start date.
Deploy preview: https://deploy-preview-12177--material-ui-x.netlify.app/ |
430b415
to
5e75abe
Compare
5e75abe
to
9ad6638
Compare
@@ -488,65 +521,10 @@ describe('<DesktopDateRangePicker />', () => { | |||
expect(onClose.callCount).to.equal(1); | |||
}); | |||
|
|||
it('should call onClose, onChange with empty value and onAccept with empty value when pressing the "Clear" button', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those tests (and the equivalent on MobileDateRangePicker.test.tsx
) are already handled by testPickerActionBar.tsx
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Fixes #11269
Right now, if you click on the end input of a
DateRangePicker
and selects a date, is closes the callsonAccept
and closes the picker even though you never clicked on the start date.But if you click on the start input and selects a date, it jumps to the end date and do not closes the picker.
I am not sure how this behavior should inter-play with the
defaultRangePosition
. Should we consider that when opening the picker through the input equal todefaultRangePosition
we only have to select this value and if we open the picker through the other input we have to select both values (not sure how to implement this).Should we have the same behavior on the
DateRangeCalendar
when used alone?