Choosing a date implementation and date format settings
MtxNativeDatetimeModule
import { MtxNativeDatetimeModule } from '@ng-matero/extensions/core';
MtxMomentDatetimeModule
npm i moment
npm i @angular/material-moment-adapter
npm i @ng-matero/extensions-moment-adapter
import { MtxMomentDatetimeModule } from '@ng-matero/extensions-moment-adapter';
MtxLuxonDatetimeModule
npm i luxon
npm i @angular/material-luxon-adapter
npm i @ng-matero/extensions-luxon-adapter
import { MtxLuxonDatetimeModule } from '@ng-matero/extensions-luxon-adapter';
MtxDateFnsDatetimeModule
npm i date-fns
npm i @angular/material-date-fns-adapter
npm i @ng-matero/extensions-date-fns-adapter
import { MtxDateFnsDatetimeModule } from '@ng-matero/extensions-date-fns-adapter';
Customizing the parse and display formats
The MTX_DATETIME_FORMATS object is a collection of formats that the datetimepicker uses when parsing and displaying dates. These formats are passed through to the DatetimeAdapter so you will want to make sure that the format objects you're using are compatible with the DatetimeAdapter used in your app.
If you want use one of the DatetimeAdapter that ships with Angular Material, but use your own MTX_DATETIME_FORMATS, you can import the NativeDatetimeModule or MomentDatetimeModule. These modules are identical to the "Mtx"-prefixed versions (MtxNativeDatetimeModule and MtxMomentDatetimeModule) except they do not include the default formats.
The various text strings used by the datetimepicker are provided through MtxDatetimepickerIntl. Localization of these messages can be done by providing a subclass with translated values in your application root module.
Setting the locale code
It also needs
MAT_DATE_LOCALE
injection token to customize the locale code. Please check the Material docs:https://material.angular.io/components/datepicker/overview#setting-the-locale-code
Choosing a date implementation and date format settings
MtxNativeDatetimeModule
MtxMomentDatetimeModule
MtxLuxonDatetimeModule
MtxDateFnsDatetimeModule
Customizing the parse and display formats
The
MTX_DATETIME_FORMATS
object is a collection of formats that the datetimepicker uses when parsing and displaying dates. These formats are passed through to theDatetimeAdapter
so you will want to make sure that the format objects you're using are compatible with theDatetimeAdapter
used in your app.If you want use one of the
DatetimeAdapter
that ships with Angular Material, but use your ownMTX_DATETIME_FORMATS
, you can import theNativeDatetimeModule
orMomentDatetimeModule
. These modules are identical to the "Mtx"-prefixed versions (MtxNativeDatetimeModule
andMtxMomentDatetimeModule
) except they do not include the default formats.For moment adapter
For luxon adapter
Check the PR https://github.com/ng-matero/extensions/pull/138
For date-fns adapter
Check the PR https://github.com/ng-matero/extensions/pull/140
Localizing labels and messages
The various text strings used by the datetimepicker are provided through MtxDatetimepickerIntl. Localization of these messages can be done by providing a subclass with translated values in your application root module.