Format month inside material ui picker

639 Views Asked by At

How to format month inside month view in material-ui picker? By default they are displayed as "short" (Jan) and I want to display "long" names (January). I followed their documentation but couldn't figure out why it doesn't work. I am using date-fns along with MuiPickersUtilsProvider. Formating days is working as expected.

Current code:

import DateFnsUtils from '@date-io/date-fns';

class LocalizedUtils extends DateFnsUtils {
  //doesn't work
  getMonthText(date: Date) {
    return format(date, 'MMMM');
  }
  // work as expected
  getDayText(date: Date) {
    return format(date, 'do');
  }
}


<MuiPickersUtilsProvider utils={LocalizedUtils}>
  <DatePiceker someProps />
</MuiPickersUtilsProvider>
0

There are 0 best solutions below