fix: add correct language for datepicker

This commit is contained in:
Polianin Nikita 2024-09-01 00:29:54 +03:00
parent 42d831892a
commit 916aa2fd9c

View File

@ -2,7 +2,7 @@ import {Component} from '@angular/core';
import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
import {NavigationService} from "@service/navigation.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 {MatSelectModule} from "@angular/material/select";
import {MatInput} from "@angular/material/input";
@ -26,13 +26,17 @@ import {MatDatepickerModule} from "@angular/material/datepicker";
MatNativeDateModule
],
templateUrl: './schedule.component.html',
providers: [{provide: MAT_DATE_LOCALE, useValue: 'ru-RU'}]
})
export class ScheduleComponent {
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({
cron: ['0 */6 * * *', Validators.pattern(/^(\S+\s){4}\S$/)],
startTerm: ['', Validators.required]