There is no required validator available for p-calendar control of PrimeNG:
<p-calendar formControlName="startDateControl" [minDate]="today" showIcon="true"></p-calendar>
Is there any workaround?
Yes there is. PrimeNG Calendar Docs
[required]="true"
When present, it specifies that an input field must be filled out before submitting the form.
<p-calendar formControlName="startDateControl" [required]="true" [minDate]="today" showIcon="true"></p-calendar>
You can also specifiy it in reactive form as you've used formControlName
.
this.calendarForm = this.fb.group({
'startDateControl': [null, Validators.required] // <-- Like this
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With