@@ -210,20 +210,34 @@ It's also possible to set the locale at runtime using the `setLocale` method of
210
210
The datepicker was built to be date implementation agnostic. This means that it can be made to work
211
211
with a variety of different date implementations. However it also means that developers need to make
212
212
sure to provide the appropriate pieces for the datepicker to work with their chosen implementation.
213
- The easiest way to ensure this is just to import one of the pre-made modules:
214
213
215
- | Module | Date type| Supported locales | Dependencies | Import from |
216
- | ---------------------| ---------| -----------------------------------------------------------------------| ----------------------------------| ----------------------------------|
217
- | ` MatNativeDateModule ` | ` Date ` | en-US | None | ` @angular/material ` |
218
- | ` MatMomentDateModule ` | ` Moment ` | [ See project] ( https://github.com/moment/moment/tree/develop/src/locale ) | [ Moment.js] ( https://momentjs.com/ ) | ` @angular/material-moment-adapter ` |
214
+ The easiest way to ensure this is to import one of the provided date modules:
219
215
220
- * Please note: ` MatNativeDateModule ` is based off of the functionality available in JavaScript's
221
- native ` Date ` object, and is thus not suitable for many locales. One of the biggest shortcomings of
222
- the native ` Date ` object is the inability to set the parse format. We highly recommend using the
223
- ` MomentDateAdapter ` or a custom ` DateAdapter ` that works with the formatting/parsing library of your
224
- choice.*
216
+ ` MatNativeDateModule `
225
217
226
- These modules include providers for ` DateAdapter ` and ` MAT_DATE_FORMATS `
218
+ | | |
219
+ | ---------------------| ------------------------|
220
+ | Date type | ` Date ` |
221
+ | Supported locales | en-US |
222
+ | Dependencies | None |
223
+ | Import from | ` @angular/material/core ` |
224
+
225
+ ` MatMomentDateModule `
226
+
227
+ | | |
228
+ | ---------------------| ----------------------------------|
229
+ | Date type | ` Moment ` |
230
+ | Supported locales | [ See project] ( https://github.com/moment/moment/tree/develop/src/locale ) for details|
231
+ | Dependencies | [ Moment.js] ( https://momentjs.com/ ) |
232
+ | Import from | ` @angular/material-moment-adapter ` |
233
+
234
+ * Please note: ` MatNativeDateModule ` is based off the functionality available in JavaScript's
235
+ native [ ` Date ` object] ( https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date ) .
236
+ Thus it is not suitable for many locales. One of the biggest shortcomings of the native ` Date `
237
+ object is the inability to set the parse format. We highly recommend using the ` MomentDateAdapter `
238
+ or a custom ` DateAdapter ` that works with the formatting/parsing library of your choice.*
239
+
240
+ These modules include providers for ` DateAdapter ` and ` MAT_DATE_FORMATS ` .
227
241
228
242
``` ts
229
243
@NgModule ({
@@ -292,7 +306,7 @@ export class MyApp {}
292
306
293
307
#### Customizing the parse and display formats
294
308
295
- The ` MAT_DATE_FORMATS ` object is just a collection of formats that the datepicker uses when parsing
309
+ The ` MAT_DATE_FORMATS ` object is a collection of formats that the datepicker uses when parsing
296
310
and displaying dates. These formats are passed through to the ` DateAdapter ` so you will want to make
297
311
sure that the format objects you're using are compatible with the ` DateAdapter ` used in your app.
298
312
0 commit comments