You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`locale`|[`Locale`](https://date-fns.org/docs/I18n)| Set the locale. Default is `en-US`. |
14
14
15
-
### 1. Install date-fns
15
+
DayPicker export the [date-fns](https://date-fns.org) locales for easier calendar localization. To set a different locale, import it from `react-day-picker/locale`.
16
16
17
-
DayPicker uses the [date-fns](https://date-fns.org) library for calendar localization. To set a different locale, install `date-fns`:
18
-
19
-
```bash npm2yarn
20
-
npm install date-fns
17
+
```bash ts
18
+
// import the locale object
19
+
import { es } from "react-day-picker/locale";
21
20
```
22
21
23
-
### 2. Set a Different Locale
24
-
25
-
By default, the locale is set to English (US). To localize the calendar, pass a [`Locale`](https://date-fns.org/docs/I18n) object to the `locale` prop.
22
+
By default, the locale is set to English (US). To localize the calendar, pass the imported [`Locale`](https://date-fns.org/docs/I18n) object to the `locale` prop.
26
23
27
24
For example, to localize the calendar in Spanish, import the `es` locale object from `date-fns` and pass it to the component.
28
25
29
26
```tsx
30
-
import { es } from"date-fns/locale";
27
+
import { es } from "react-day-picker/locale";
31
28
32
29
<DayPicker locale={es} />; // Set the locale to Spanish
0 commit comments