How to override label naming without specifying a DateUtil(moment, datefns, etc)

122 Views Asked by At

I'm creating a custom component with custom styles using KeyboardDatePicker from @material-ui/pickers.

I need to customize the labels. I know that I can use getWeekdays based on https://material-ui-pickers.dev/guides/formats and using MuiPickersUtilsProvider. But in order to do so, I need to extend from a DateUtil (moment, datefns, etc).

class CustomDateUtil extends MomentUtils // or any other util {
   getWeekdays() {
     ...
   }
}

and then

<MuiPickersUtilsProvider utils={CustomDateUtil}>
  ....
</MuiPickersUtilsProvider>

What I want to accomplish is the label renaming without the need of depending on a specific DateUtil. It's like doing this but in a generic way, for all DateUtils.

0

There are 0 best solutions below