validated the last ocurrence date

This commit is contained in:
EQUILIBRIUM\hirondino.van-dunem
2022-07-06 09:12:57 +01:00
parent a25eea749e
commit 3a3ba605dd
8 changed files with 19 additions and 3 deletions
@@ -134,6 +134,7 @@
<input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date"
[(ngModel)]="postEvent.StartDate"
[min]="currentDate"
[max]="maxDate"
[disabled]="disabled"
>
@@ -162,6 +163,7 @@
<input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date"
[(ngModel)]="postEvent.EndDate"
[min]="currentDate"
[max]="maxDate"
[disabled]="disabled"
>
@@ -213,6 +215,7 @@
placeholder="Choose a date"
[(ngModel)]="postEvent.EventRecurrence.LastOccurrence"
[disabled]="disabled"
[min]="postEvent.EndDate"
>
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #occurrrence
@@ -247,6 +247,9 @@ export class EditEventPage implements OnInit {
IsRecurring: new FormControl(this.postEvent.IsRecurring, [
Validators.required
]),
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok']: this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok': null, [
Validators.required
]),
Date: new FormControl(new Date(this.postEvent.StartDate).getTime() <= new Date(this.postEvent.EndDate).getTime()? 'ok': null,[
Validators.required
]),