mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
fix(input): correctly handle invalid model values for input[date/time/…]
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 #8949 Closes #9375
This commit is contained in:
11
docs/content/error/ngModel/datefmt.ngdoc
Normal file
11
docs/content/error/ngModel/datefmt.ngdoc
Normal file
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user