forked from angular/angular.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(input): correctly handle invalid model values for `input[date/tim…
…e/…]` Similar to `input[number]` Angular will throw if the model value for a `input[date]` is not a `Date` object. For `Invalid Date`s (dates whose `getTime()` is `NaN`) `input[date]` will render an empty string. Closes angular#8949 Closes angular#9375
- Loading branch information
Showing
3 changed files
with
60 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@ngdoc error | ||
@name ngModel:datefmt | ||
@fullName Model is not a date object | ||
@description | ||
|
||
All date-related inputs like `<input type="date">` require the model to be a `Date` object. | ||
If the model is something else, this error will be thrown. | ||
Angular does not set validation errors on the `<input>` in this case | ||
as those errors are shown to the user, but the erroneous state was | ||
caused by incorrect application logic and not by the user. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters