javascript - Error: [ngModel:datefmt] Expected `2015-05-29T19:06:16.693209Z` to be a date - Angular -
i'm working on angular
application django
rest-framework
..
the app receives it's info json server.. 1 of keys created_time
... value of field format according iso-8601
, example 2015-05-29t19:06:16.693209z
.
in client have field:
<input type="time" ng-model="created_time">
but when data arriving error:
error: [ngmodel:datefmt] expected `2015-05-29t19:06:16.693209z` date http://errors.angularjs.org/1.3.13/ngmodel/datefmt?p0=2015-05-29t19%3a06%3a16.693209z @ regex_string_regexp (angular.js:63) @ array.<anonymous> (angular.js:19807) @ object.ngmodelwatch (angular.js:23289) @ scope.$get.scope.$digest (angular.js:14235) @ scope.$get.scope.$apply (angular.js:14506) @ done (angular.js:9659) @ completerequest (angular.js:9849) @ xmlhttprequest.requestloaded (angular.js:9790)
i tried :( format instructions in docs of angular...
this must happening angular 1.3+. 1.3+ on wards ng-model date/time input needs valid date object, string representation of date no longer allowed. need convert string date object ($scope.created_time = new date(datestring)
) , bind ng-model. if follow error link has clear description error , how resolve it.
all date-related inputs require model date object. if model else, error thrown. angular not set validation errors on in case errors shown user, erroneous state caused incorrect application logic , not user.
Comments
Post a Comment