fix: add correct language for datepicker
This commit is contained in:
parent
42d831892a
commit
916aa2fd9c
@ -2,7 +2,7 @@ import {Component} from '@angular/core';
|
|||||||
import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||||
import {NavigationService} from "@service/navigation.service";
|
import {NavigationService} from "@service/navigation.service";
|
||||||
import SetupService from "@api/v1/setup.service";
|
import SetupService from "@api/v1/setup.service";
|
||||||
import {MAT_DATE_LOCALE, MatNativeDateModule} from "@angular/material/core";
|
import {DateAdapter, MatNativeDateModule} from "@angular/material/core";
|
||||||
import {MatFormFieldModule} from "@angular/material/form-field";
|
import {MatFormFieldModule} from "@angular/material/form-field";
|
||||||
import {MatSelectModule} from "@angular/material/select";
|
import {MatSelectModule} from "@angular/material/select";
|
||||||
import {MatInput} from "@angular/material/input";
|
import {MatInput} from "@angular/material/input";
|
||||||
@ -26,13 +26,17 @@ import {MatDatepickerModule} from "@angular/material/datepicker";
|
|||||||
MatNativeDateModule
|
MatNativeDateModule
|
||||||
],
|
],
|
||||||
templateUrl: './schedule.component.html',
|
templateUrl: './schedule.component.html',
|
||||||
providers: [{provide: MAT_DATE_LOCALE, useValue: 'ru-RU'}]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export class ScheduleComponent {
|
export class ScheduleComponent {
|
||||||
protected scheduleSettings!: FormGroup;
|
protected scheduleSettings!: FormGroup;
|
||||||
|
|
||||||
constructor(private navigationService: NavigationService, formBuilder: FormBuilder, private api: SetupService) {
|
constructor(
|
||||||
|
private navigationService: NavigationService,
|
||||||
|
formBuilder: FormBuilder,
|
||||||
|
private api: SetupService,
|
||||||
|
adapter: DateAdapter<any>) {
|
||||||
|
adapter.setLocale(navigator.language);
|
||||||
this.scheduleSettings = formBuilder.group({
|
this.scheduleSettings = formBuilder.group({
|
||||||
cron: ['0 */6 * * *', Validators.pattern(/^(\S+\s){4}\S$/)],
|
cron: ['0 */6 * * *', Validators.pattern(/^(\S+\s){4}\S$/)],
|
||||||
startTerm: ['', Validators.required]
|
startTerm: ['', Validators.required]
|
||||||
|
Loading…
Reference in New Issue
Block a user