You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
For moment adapter
import{MTX_DATETIME_FORMATS}from'@ng-matero/extensions/core';import{MtxDatetimepickerModule}from'@ng-matero/extensions/datetimepicker';import{MtxMomentDatetimeModule}from'@ng-matero/extensions-moment-adapter';
@NgModule({imports: [MtxDatetimepickerModule,MtxMomentDatetimeModule,// <= It also works with MomentDatetimeModule],providers: [{provide: MTX_DATETIME_FORMATS,useValue: {parse: {dateInput: 'YYYY-MM-DD',monthInput: 'MMMM',yearInput: 'YYYY',timeInput: 'HH:mm',datetimeInput: 'YYYY-MM-DD HH:mm',},display: {dateInput: 'YYYY-MM-DD',monthInput: 'MMMM',yearInput: 'YYYY',timeInput: 'HH:mm',datetimeInput: 'YYYY-MM-DD HH:mm',monthYearLabel: 'YYYY MMMM',dateA11yLabel: 'LL',monthYearA11yLabel: 'MMMM YYYY',popupHeaderDateLabel: 'MMM DD, ddd',},},},],})
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.
Uh oh!
There was an error while loading. Please reload this page.
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 #138
For date-fns adapter
Check the PR #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.
The text was updated successfully, but these errors were encountered: