嗨,我正在使用角材料 DatePicker https://material.angular.io/components/datepicker/examples,我只需要选择 Year,我该如何正确执行此操作?这就是我所做的:
<div class="form-group row">
<label class="col-xl-3 col-lg-3 col-form-label">Production Year</label>
<div class="col-lg-9 col-xl-8">
<mat-form-field>
<input matInput [matDatepicker]="productionYearPicker" placeholder="Choose a date"
formControlName="productionYear"
[class.is-invalid]="isControlInvalid('productionYear')"
[class.is-valid]="isControlValid('productionYear')">
<mat-datepicker-toggle matSuffix [for]="productionYearPicker"></mat-datepicker-toggle>
<mat-datepicker #productionYearPicker startView="multi-year"></mat-datepicker>
</mat-form-field>
</div>
</div>
datePicker 可以以年开头,但我仍然必须选择月份,并且在输入框中,当我只输入年份时,它会自动将其格式化为 1 月 1 日,我如何禁用月份和日期?我只需要年份选择器