Skip to content

Commit

Permalink
refactor (value): small adaptions in date value comp.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Schweizer committed Apr 8, 2020
1 parent ec7687d commit f5d7a65
Showing 1 changed file with 4 additions and 5 deletions.
Expand Up @@ -12,10 +12,10 @@ import {
import {Subscription} from 'rxjs';
import {BaseValueComponent} from '../base-value.component';
import {ErrorStateMatcher} from '@angular/material';
import {DateInputComponent} from "./date-input/date-input.component";
import {DateInputComponent} from './date-input/date-input.component';

/** Error when invalid control is dirty, touched, or submitted. */
export class IntervalErrorStateMatcher implements ErrorStateMatcher {
export class DateErrorStateMatcher implements ErrorStateMatcher {
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const isSubmitted = form && form.submitted;
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
Expand All @@ -39,11 +39,10 @@ export class DateValueComponent extends BaseValueComponent implements OnInit, On
form: FormGroup;

valueChangesSubscription: Subscription;

// TODO: check that both dates have the same calendar in case of a KnoraPeriod

customValidators = [];

matcher = new IntervalErrorStateMatcher();
matcher = new DateErrorStateMatcher();

constructor(@Inject(FormBuilder) private fb: FormBuilder) {
super();
Expand Down

0 comments on commit f5d7a65

Please sign in to comment.