How to fix date format in react-calendar without changing weekday name format in ja locale?

Viewed 38

I'm using react-calendar library and cannnot fix code anymore.

When locale is 'ja', it returns dates with 'XX日'.

I'm using locale 'ja', and I want to fix these dates to "XX".

I tried to change locale 'en' to fix 'XX日' to 'XX'. It successed. But weekday name also changed "Sun, Mon, Thu ...".

I want to fix 'XX日' without changing weekday names '日, 月, 火...'. So how do I set the component property?

This is the code I wrote.

<Calendar
    calendarType='US'
    locale='ja'
    value={startDate}
    onChange={changeMethod}         
/>
1 Answers

From the React Calendar documentation

formatDay Function called to override default formatting of day tile labels. Can be used to use your own formatting function.

(locale, date) => formatDate(date, 'd')
Related