React-calendar: How to show a calendar with shorten Month names?

Created on 13 Dec 2019  路  3Comments  路  Source: wojtekmaj/react-calendar

So far I am not able to figure out how to display short month names? Like December -> Dec

Screenshot from 2019-12-13 11-45-15

This is my code exaple

    formatMonth = () => {
      return (locale, date) => { month: 'short' }
    }

   render() {
    return (
      <CalendarInput
        value=''
        returnValue="range"
        calendarType="US"
        className={classes.calendar}
        onChange={() => {
          // Need to implement
        }}
        formatMonth={this.formatMonth}
      />
    );
   }

What am I missing?

question

All 3 comments

That function is formatting month and year, so you're looking for formatMonthYear.

Okay. Thank you. Can you tell me how to implement that with the same code above? @wojtekmaj

Probably something like

formatMonthYear={(locale, date) => date.toLocaleString(locale, { month: 'short', year: 'numeric' )}

would suffice.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ktse picture ktse  路  6Comments

Chusynuk picture Chusynuk  路  3Comments

rmccue picture rmccue  路  4Comments

spoldman picture spoldman  路  4Comments

dumkanki picture dumkanki  路  3Comments