@@ -210,20 +210,62 @@ 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 ` |
219
-
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.*
225
-
226
- These modules include providers for ` DateAdapter ` and ` MAT_DATE_FORMATS `
214
+ The easiest way to ensure this is to import one of the provided date modules:
215
+
216
+ ` MatNativeDateModule `
217
+
218
+ <table >
219
+ <tbody >
220
+ <tr >
221
+ <th align="left" scope="row">Date type</th>
222
+ <td><code>Date</code></td>
223
+ </tr >
224
+ <tr >
225
+ <th align="left" scope="row">Supported locales</th>
226
+ <td>en-US</td>
227
+ </tr >
228
+ <tr >
229
+ <th align="left" scope="row">Dependencies</th>
230
+ <td>None</td>
231
+ </tr >
232
+ <tr >
233
+ <th align="left" scope="row">Import from</th>
234
+ <td><code>@angular/material/core</code></td>
235
+ </tr >
236
+ </tbody >
237
+ </table >
238
+
239
+ ` MatMomentDateModule `
240
+
241
+ <table >
242
+ <tbody >
243
+ <tr >
244
+ <th align="left" scope="row">Date type</th>
245
+ <td><code>Moment</code></td>
246
+ </tr >
247
+ <tr >
248
+ <th align="left" scope="row">Supported locales</th>
249
+ <td><a href="https://github.com/moment/moment/tree/develop/src/locale) for details">See project</a></td>
250
+ </tr >
251
+ <tr >
252
+ <th align="left" scope="row">Dependencies</th>
253
+ <td><a href="https://momentjs.com/">Moment.js</a></td>
254
+ </tr >
255
+ <tr >
256
+ <th align="left" scope="row">Import from</th>
257
+ <td><code>@angular/material-moment-adapter</code></td>
258
+ </tr >
259
+ </tbody >
260
+ </table >
261
+
262
+ * Please note: ` MatNativeDateModule ` is based off the functionality available in JavaScript's
263
+ native [ ` Date ` object] ( https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date ) .
264
+ Thus it is not suitable for many locales. One of the biggest shortcomings of the native ` Date `
265
+ object is the inability to set the parse format. We highly recommend using the ` MomentDateAdapter `
266
+ or a custom ` DateAdapter ` that works with the formatting/parsing library of your choice.*
267
+
268
+ These modules include providers for ` DateAdapter ` and ` MAT_DATE_FORMATS ` .
227
269
228
270
``` ts
229
271
@NgModule ({
@@ -292,7 +334,7 @@ export class MyApp {}
292
334
293
335
#### Customizing the parse and display formats
294
336
295
- The ` MAT_DATE_FORMATS ` object is just a collection of formats that the datepicker uses when parsing
337
+ The ` MAT_DATE_FORMATS ` object is a collection of formats that the datepicker uses when parsing
296
338
and displaying dates. These formats are passed through to the ` DateAdapter ` so you will want to make
297
339
sure that the format objects you're using are compatible with the ` DateAdapter ` used in your app.
298
340
0 commit comments