refactor: move custom adapter to providers
All checks were successful
Build and Deploy Angular App / build (push) Successful in 48s

This commit is contained in:
Polianin Nikita 2024-08-26 02:16:37 +03:00
parent 7a9bca86bc
commit dba0d3cd62

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 {DateAdapter, MatNativeDateModule} from "@angular/material/core";
import {MAT_DATE_LOCALE, MatNativeDateModule} from "@angular/material/core";
import {MatFormFieldModule} from "@angular/material/form-field";
import {MatSelectModule} from "@angular/material/select";
import {MatInput} from "@angular/material/input";
@ -25,17 +25,16 @@ import {MatDatepickerModule} from "@angular/material/datepicker";
MatDatepickerModule,
MatNativeDateModule
],
templateUrl: './schedule.component.html'
templateUrl: './schedule.component.html',
providers: [{provide: MAT_DATE_LOCALE, useValue: 'ru-RU'}]
})
export class ScheduleComponent {
protected scheduleSettings!: FormGroup;
constructor(
private navigationService: NavigationService, private formBuilder: FormBuilder, private api: SetupService, private _adapter: DateAdapter<any>) {
this._adapter.setLocale('ru');
this.scheduleSettings = this.formBuilder.group({
cron: ['0 */6 * * *', Validators.pattern(/^([^\s]+\s){4}[^\s]{1}$/)],
constructor(private navigationService: NavigationService, formBuilder: FormBuilder, private api: SetupService) {
this.scheduleSettings = formBuilder.group({
cron: ['0 */6 * * *', Validators.pattern(/^(\S+\s){4}\S$/)],
startTerm: ['', Validators.required]
}
);