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

ToolbarComponent is not working for DesktopDateRangePicker or MobileDateRangePicker #1948

Closed
aamirafridi opened this issue Jul 2, 2020 · 21 comments
Labels

Comments

@aamirafridi
Copy link
Contributor

I am trying to add some buttons in the toolbar but doesn't seem to be working

https://codesandbox.io/s/material-ui-date-range-qd0wz?file=/src/index.tsx

@aamirafridi aamirafridi added the status: needs triage These issues haven't been looked at yet by a maintainer. label Jul 2, 2020
@aamirafridi
Copy link
Contributor Author

toolbarTitle is also not working

@dmtrKovalenko
Copy link
Member

dmtrKovalenko commented Jul 2, 2020

toolbarTitle is also not working

Must be fixed by #1914

@aamirafridi
Copy link
Contributor Author

@dmtrKovalenko Which version should have the above fix?

@dmtrKovalenko
Copy link
Member

The next

@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 3, 2020

toolbarTitle is also not working

@aamirafridi if you could test again once @material-ui/pickers@v4.0.0-alpha.9 is released, it will be perfect :).

@oliviertassinari
Copy link
Member

Also, I see that #1914 is missing a test case. If we could resolve the issue with one, it will be perfect.

@oliviertassinari oliviertassinari added bug 🐛 Something isn't working component: DateRangePicker and removed status: needs triage These issues haven't been looked at yet by a maintainer. labels Jul 3, 2020
@aamirafridi
Copy link
Contributor Author

Sure, Can someone ping me once it is released? I will give it ago

@oliviertassinari
Copy link
Member

@aamirafridi You can subscribe to new releases with:

Capture d’écran 2020-07-03 à 15 33 33

@aamirafridi
Copy link
Contributor Author

Done, I will try after the next release

@aamirafridi
Copy link
Contributor Author

oh no....
shouldDisableDate is not working :(

shouldDisableDate={() => false}

I can still select any date. https://codesandbox.io/s/material-ui-date-range-qd0wz?file=/src/index.tsx

@dmtrKovalenko
Copy link
Member

dmtrKovalenko commented Jul 3, 2020

I am seeing, that it is pretty common mistake. shouldDisableDate must return true in order to disable date.

Isn’t it clear @aamirafridi?

@aamirafridi
Copy link
Contributor Author

aamirafridi commented Jul 3, 2020

image

it worked, sorry for the wrong alert

@aamirafridi
Copy link
Contributor Author

renderDay also doesn't seems to be working https://codesandbox.io/s/material-ui-date-range-h3nlq?file=/src/index.tsx

@aamirafridi
Copy link
Contributor Author

Same for autoOk
docs says default is false but calendar disappears after you select 2nd date
basically all props need to be checked

@aamirafridi
Copy link
Contributor Author

shouldDisableYear is not working :(

@dmtrKovalenko
Copy link
Member

This is already fixed in alpha.9

@aamirafridi
Copy link
Contributor Author

ToolbarComponent is still not working https://codesandbox.io/s/material-ui-date-range-qd0wz?file=/src/index.tsx

@aamirafridi
Copy link
Contributor Author

also, is autoOk is removed?

@aamirafridi
Copy link
Contributor Author

aamirafridi commented Jul 30, 2020

I want the user to select a date, then I will highlight X-days onward from that date to show the user a range (user cannot select end date). I tried using default DatePicker but it doesn't allow showing multiple calendars :(
So I am using DateRange where with renderInput, I just render one Input and once From date is selected, I calculate To date and set it programmatically. I want to show the OK button to the user so the user can see the range and then click OK. I was ok with autoOk true which it will close itself on selecting the first date.

Update:
just found disableCloseOnSelect

I wish there was a way to display cancel and Ok button even for the desktop to have complete control

@aamirafridi
Copy link
Contributor Author

disableCloseOnSelect is not acting to previous autOk

e.g.

onChange={(selectedDate) => {
          if (selectedDate[0]) {
            const endDate = addDays(selectedDate[0] as Date, Number(3));
            return props.onChange([selectedDate[0], endDate]);
          }
          props.onChange(selectedDate);
}}

setting end date programmatically use to close the date picker with autoOk. With disableCloseOnSelect={false} you have to click another date to make it close.

Also disableCloseOnSelect is confusing. Why not just closeOnSelect/shouldCloseOnSelect

@oliviertassinari
Copy link
Member

Also disableCloseOnSelect is confusing. Why not just closeOnSelect/shouldCloseOnSelect

Yeah, the problem is that the default value doesn't match the name convention we have for the components I have open #2050 so we don't forget to set disableCloseOnSelect={true} in v5.

@mui mui locked as off-topic and limited conversation to collaborators Jul 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants