简体   繁体   中英

Change the format of the datepicker to weekday - material ui

I want to change the format of the datepicker to weekday (Monday, Tuesday,..) The default version of the datepicker format is format="MM/dd/yyyy" Is it possible to change it?

Source code:


<MuiPickersUtilsProvider utils={DateFnsUtils}>
      <Grid container justify="space-around">
        <KeyboardDatePicker
          disableToolbar
          variant="inline"
          format="MM/dd/yyyy"
          margin="normal"
          id="date-picker-inline"
          label="Date picker inline"
          value={selectedDate}
          onChange={handleDateChange}
          KeyboardButtonProps={{
            'aria-label': 'change date',
          }}
        />

You can change the format value of KeyboardDatePicker to format="EE - MM/dd/yyyy" show the weekdays with month/date/year. Moreover, if you want to change the format of KeyboardDatePicker you can refer to here .Try this:

 <KeyboardDatePicker disableToolbar variant="inline" format="EE-MM/dd/yyyy" margin="normal" id="date-picker-inline" label="Date picker inline" value={selectedDate} onChange={handleDateChange} KeyboardButtonProps={{ 'aria-label': 'change date', }} />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM