fixed locale dates
This commit is contained in:
+27
-2
@@ -62,6 +62,9 @@ import { DurationpickerComponent } from './ui/durationpicker/durationpicker.comp
|
||||
import { InviteCodeComponent } from './pages/invites/code/code.component';
|
||||
import { InviteEditComponent } from './pages/invites/edit/invite.edit';
|
||||
import { MatPaginatorIntl } from '@angular/material/paginator';
|
||||
import { NgxMatDateAdapter, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
import { MAT_DATE_LOCALE } from '@angular/material/core';
|
||||
import { NgxMatMomentAdapter } from '@angular-material-components/moment-adapter';
|
||||
|
||||
|
||||
export function init_app(i18n: I18nService) {
|
||||
@@ -82,7 +85,7 @@ export class XhrInterceptor implements HttpInterceptor {
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AutofocusDirective,
|
||||
I18nPipe,I18nEmptyPipe,
|
||||
I18nPipe, I18nEmptyPipe,
|
||||
MomentPipe,
|
||||
MainComponent,
|
||||
AppComponent,
|
||||
@@ -133,7 +136,7 @@ export class XhrInterceptor implements HttpInterceptor {
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
QrCodeModule,
|
||||
|
||||
|
||||
],
|
||||
exports: [ MaterialModule ],
|
||||
providers: [ { provide: APP_INITIALIZER, useFactory: init_app, deps: [ I18nService ], multi: true }, { provide: HTTP_INTERCEPTORS, useClass: XhrInterceptor, multi: true }, DatePipe,
|
||||
@@ -143,6 +146,28 @@ export class XhrInterceptor implements HttpInterceptor {
|
||||
service.injectI18n(i18n)
|
||||
return service;
|
||||
}, deps: [ I18nService ]
|
||||
},
|
||||
{
|
||||
provide: NgxMatDateAdapter,
|
||||
useClass: NgxMatMomentAdapter,
|
||||
useFactory: (i18n: I18nService) => {
|
||||
return new NgxMatMomentAdapter(i18n.getLocale());
|
||||
}, deps: [ I18nService ]
|
||||
}, {
|
||||
provide: NGX_MAT_DATE_FORMATS, useFactory: (i18n: I18nService) => {
|
||||
const datetimeformat = i18n.get('format.datetime', []);
|
||||
return {
|
||||
parse: {
|
||||
dateInput: "l, LTS"
|
||||
},
|
||||
display: {
|
||||
dateInput: datetimeformat,
|
||||
monthYearLabel: "MMM YYYY",
|
||||
dateA11yLabel: "LL",
|
||||
monthYearA11yLabel: "MMMM YYYY"
|
||||
}
|
||||
};
|
||||
}, deps: [ I18nService ]
|
||||
} ],
|
||||
bootstrap: [ AppComponent ],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user