Using AngularJS I am trying to display a date using an input type=date:
<input ng-model="campaign.date_start" type="date">
However, this gives the following error:
Error: error:datefmt
Model is not a date object
The date actually comes from a JSON API in the following format:
date_start": "2014-11-19"
I thought that I could resolve it by using a filter, but this did not work and I get the same error with:
<input ng-model="campaign.date_start | date" type="date">
I have also tried converting the string to a date, but again I get the same error:
$scope.campaign.date_start = Date(campaign.date_start);
What else can I try?
new Date("2014-11-19");, it works fine, so problem is somewhere in you data representation.