Я хочу проверить дату начала с датой окончания в угловом формате.
Дата начала турнира {{error.errorMessage}} ->
<div class="form-group">
<label class="lable label-default" for="TournamentEndDate"> Tournament End-Date</label>
<input class="form-control" id="TournamentEndDate" type="date" name='TournamentEndDate' [(ngModel)]="tourDetails.TournamentEndDate"
(change)="checkEdate(tourDetails.TournamentEndDate)">
<!-- <div *ngIf="error.isError" class="alert alert-danger">
{{ error.errorMessage }}
</div> -->
</div>
component.ts
checkSdate(value) {
console.log(value);
if (value >= new Date(this.tourDetails.TournamentEndDate)) {
this.error = { isError: true, errorMessage: 'Start Date should be smaller than End Date' };
}
}
checkEdate(value) {
console.log(value);
if (value < new Date(this.tourDetails.TournamentStartDate)) {
this.error = { isError: true, errorMessage: 'End Date must be Greater than Start Date' };
}
}