Localization Props
Change the Locale
To change the locale, pass to the locale
prop a date-fns Locale object.
For example, to localize the calendar in Spanish, import the es
locale object from date-fns and pass it to the component.
Override the First Day of the Week
Use weekStartsOn
to override the first day of the week.
Set the First Week of the Year
To override the date in the first week of the year, use firstWeekContainsDate
. Use this prop to change the week number calculation according to date-fns getWeek function.
Switch to ISO Week Dates
DayPicker uses date-fns getWeek to calculate the week number. By default, the week starts on Sunday and the first week of the year is the one that contains January 1st. Use ISOWeek
to switch using ISO Week Dates instead of the locale setting.
Translate ARIA labels
Use the labels prop to translate the labels used for ARIA.
TODO: This section is still a draft.
Switch the Text Direction
To add right-to-left text direction, set the dir
prop to rtl
.
Change the Numbering System
Use formatters to change the numbering system used in the calendar.
For example, to switch to hindu-arabic using toLocaleString: