mui / material-ui-pickers

Date & Time pickers for Material UI (support from v1 to v4)
https://github.com/mui/material-ui-pickers/issues/2157
MIT License
2.32k stars 832 forks source link

DateRangePicker. Unable to override Day Component #1722

Closed MikeInCode closed 4 years ago

MikeInCode commented 4 years ago

There is no ability to override Day Component in DateRangePicker via renderDay props

In source code seems like find the location of the problem Default renderDay always override our passed prop renderDay

<Calendar
        {...other}
        date={date}
        onChange={onChange}
        renderDay={(day, _, DayProps) => (
          <DateRangeDay
            isPreviewing={false}
            isStartOfPreviewing={false}
            isEndOfPreviewing={false}
            isHighlighting={isWithinRange(utils, day, date)}
            isStartOfHighlighting={isStartOfRange(utils, day, date)}
            isEndOfHighlighting={isEndOfRange(utils, day, date)}
            {...DayProps}
          />
        )}
      />
dmtrKovalenko commented 4 years ago

Really. Thanks its a pitfall XD

MikeInCode commented 4 years ago

Really. Thanks its a pitfall XD

Will be fixed in the next release? :)

oscar-b commented 4 years ago

@dmtrKovalenko Is it enough to move {...other} to the end, or do you think that will cause other problems? I could whip up a PR for that otherwise.

dmtrKovalenko commented 4 years ago

We need to pass DateRangeProps. All of these isHighlighting props

oliviertassinari commented 4 years ago

Duplicate of #1856