1

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 Answers1

0

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')
rohan1122
  • 120
  • 4
  • I couldn't make sense the meaning of 'formatDate', but finally resolved. Thank you so much and I should read the docs more... – masahisa nario Jul 27 '22 at 11:48