(event: Event)
| 324 | } |
| 325 | |
| 326 | _onInput(event: Event) { |
| 327 | const value = (event.target as HTMLInputElement).value; |
| 328 | const lastValueWasValid = this._lastValueValid; |
| 329 | let date = this._dateAdapter.parse(value, this._dateFormats.parse.dateInput); |
| 330 | this._lastValueValid = this._isValidValue(date); |
| 331 | date = this._dateAdapter.getValidDateOrNull(date); |
| 332 | const hasChanged = !this._dateAdapter.sameDate(date, this.value); |
| 333 | |
| 334 | // We need to fire the CVA change event for all |
| 335 | // nulls, otherwise the validators won't run. |
| 336 | if (!date || hasChanged) { |
| 337 | this._cvaOnChange(date); |
| 338 | } else { |
| 339 | // Call the CVA change handler for invalid values |
| 340 | // since this is what marks the control as dirty. |
| 341 | if (value && !this.value) { |
| 342 | this._cvaOnChange(date); |
| 343 | } |
| 344 | |
| 345 | if (lastValueWasValid !== this._lastValueValid) { |
| 346 | this._validatorOnChange(); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | if (hasChanged) { |
| 351 | this._assignValue(date); |
| 352 | this.dateInput.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement)); |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | _onChange() { |
| 357 | this.dateChange.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement)); |
nothing calls this directly
no test coverage detected