我有一个时间字段,当由于此管道| HH:mm而导致用户键入值时,仅键入时我在控制台中收到无效的日期错误。如何处理ts文件中的无效日期。
HTML
<input type="text" (ngModelChange)="onChangeStartTime($event)"
id="starttime" placeholder="hh:mm"[ngModel]="startTime | date: 'HH:mm'" maxlength="5" appInputRestriction="time"/>
TS
onChangeStartTime(date: Time) {
this.startTime = date;
}