0

the <DateRangePicker/> component from MUI, accept a props named calendars that accept number of calendars that showing inside component popup, like this:

like it that had "3" value as its calendars props:

enter image description here

but DatePicker component hasn't that and cant handle this.

i want two use DatePicker component, for single select and not range select, but with two calendar.

something like this just for example!: <DatePicker calendars={2} />

1 Answers1

0

The DatePicker component is built to pick one, and one date only, hence why it will only ever contain one calendar.

If you want to select 2 dates, either use 2 distinct DatePickers, or use the DateRangePicker with calendars={2}.

Yoctoboy
  • 322
  • 3
  • 13
  • No, I don't want to choose two dates, I just want one date and the reason why I want to do this (two calendar for DatePicker component) is that the next or previous month is in front of the user and has a better choice. – alireza tafreshi Aug 29 '23 at 10:32
  • Interesting. I'd guess there is no way to do that using only one DatePicker, so maybe you can hack your way into that with several DatePickers managed by a common state. That being said, in terms of UX, the MUI team probably has made a conscious choice of only displaying one month at a time in a non-range DatePicker for a good reason. People are now used to having only one month in their regular DatePickers. Displaying two months in a single picker is commonly reserved for picking a date range. Hope this helps! – Yoctoboy Aug 30 '23 at 14:42