Skip to content

Commit cbef92a

Browse files
authored
docs(material/datepicker): add note about locale data in date-fns (#24067)
Adds a note about how locale data should be provided for users that consume the `date-fns` adapter. Fixes #24026.
1 parent 94f2f7e commit cbef92a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/material/datepicker/datepicker.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ export class MyApp {}
292292

293293
It's also possible to set the locale at runtime using the `setLocale` method of the `DateAdapter`.
294294

295+
**Note:** if you're using the `MatDateFnsModule`, you have to provide the data object for your
296+
locale to `MAT_DATE_LOCALE` instead of the locale code, in addition to providing a configuration
297+
compatible with `date-fns` to `MAT_DATE_FORMATS`. Locale data for `date-fns` can be imported
298+
from `date-fns/locale`.
299+
295300
<!-- example(datepicker-locale) -->
296301

297302
#### Choosing a date implementation and date format settings

0 commit comments

Comments
 (0)