我正在使用响应式表单并尝试验证 startDate 和 endDate,但不幸的是,无效、触摸、脏、验证器等表单状态不起作用。我如何验证日期?

项目设置.html
<div class="notification"> <div class=" p-formgroup-inline" [formGroup]="projectFormGroup"> <div class="p-fluid p-formgrid p-grid"> <div class="p-field p-col-12"> <p-calendar id="startDate" [dateFormat]="'dd/mm/yy'" [showIcon]="true" [(ngModel)]="startDate" selectionMode="range" placeholder="Select start date & end date" [maxDate]="" inputId="startDate" appendTo="body" [monthNavigator]="true" [style]="{'width': '100%'}"> </p-calendar> </div><button pButton type="button" class="p-button-primary" label="Download" (click)="downloadTimesheetData()"></button> <small class="p-error" *ngIf="startDate.Validators.required"> Please enter a start date & end date.</small> </div> </div>项目设置.ts
public downloadTimesheetData(): void { this.timesheetService.getAllTimsheets({ startDate: this.startDate[0], endDate: this.startDate[1] }).subscribe( data => { saveAs(data, "report.csv"); this.toastrService.success("Successfully Downloaded", "Success", { timeOut: 2000 }); }, err => { this.toastrService.error("Something Went Wrong", "Error", { timeOut: 2000 }); throw err; }); }