Hi I am using mydatepicker
in my angular project .
https://www.npmjs.com/package/mydatepicker
Git url
https://github.com/kekeh/mydatepicker#readme
I have one query, In my demo application I have two date field (DOB , date of issue pancard) .I want to show error message when user choose DOB greater than date of issue pancard or vise versa.how I will compare or validate date field in angular on button click
here is my code https://stackblitz.com/edit/angular-ypzjrk?file=src%2Fapp%2Fapp.component.ts
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { IMyDpOptions } from 'mydatepicker';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
name = 'Angular';
showError =false;
cf: FormGroup;
datePickerOptions: IMyDpOptions = {
dateFormat: 'dd/mm/yyyy',
};
constructor(private fb: FormBuilder) {
this.cf = this.fb.group({
dateOfBirth: ['',[Validators.required]],
pancard: ['',[Validators.required]]
})
}
onSubmit() {
this.showError =true;
}
}