From 330265a7e411e0cb5cbcf75579c77cf02cafdd67 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 25 Feb 2022 21:42:49 +0100 Subject: [PATCH] docs(material/datepicker): add note about locale data in date-fns Adds a note about how locale data should be provided for users that consume the `date-fns` adapter. Fixes #24026. --- src/material/datepicker/datepicker.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/material/datepicker/datepicker.md b/src/material/datepicker/datepicker.md index 8bca78ddd651..2aeea455e6a5 100644 --- a/src/material/datepicker/datepicker.md +++ b/src/material/datepicker/datepicker.md @@ -292,6 +292,11 @@ export class MyApp {} It's also possible to set the locale at runtime using the `setLocale` method of the `DateAdapter`. +**Note:** if you're using the `MatDateFnsModule`, you have to provide the data object for your +locale to `MAT_DATE_LOCALE` instead of the locale code, in addition to providing a configuration +compatible with `date-fns` to `MAT_DATE_FORMATS`. Locale data for `date-fns` can be imported +from `date-fns/locale`. + #### Choosing a date implementation and date format settings