React-calendar: Day labels

Created on 11 Jun 2019  路  6Comments  路  Source: wojtekmaj/react-calendar

Hi, is there an option to change the day labels from MON, TUE, WED to M, T, W etc?

question

Most helpful comment

You could also do it like this using toLocaleString:
formatShortWeekday={(locale, date) => date.toLocaleString(locale, { weekday: 'narrow' })}

All 6 comments

Sorry nevermind, I've figured it out now, using moment

@tuxd Can you explain how you changed it to M, T, W?

I just did a .toString().slice(0, 1) on the variable I passed to formatShortWeekday

@tuxd thanks for the response. I ended up doing this

formatShortWeekday={(locale, date) => [ `S`, `M`, `T`, `W`, `T`, `F`, `S` ][date.getDay()]}

Nice that's a bit more elegant than what I did :)

You could also do it like this using toLocaleString:
formatShortWeekday={(locale, date) => date.toLocaleString(locale, { weekday: 'narrow' })}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andymj picture andymj  路  5Comments

dumkanki picture dumkanki  路  3Comments

guydewinton picture guydewinton  路  3Comments

Muttakee31 picture Muttakee31  路  4Comments

fasmart4 picture fasmart4  路  6Comments