Reputation: 6563
I'm using below code for date.
<input type="date" value="{{data.endDate | date: "MM/dd/yyyy"}}" ng-model="data.endDate" />
If i select today date (11/22/2015) in the controller the endDate value is 2015-11-21T18:30:00.000Z
.
Upvotes: 1
Views: 2246
Reputation: 1
Thanks nishi bangar,
The simplest way, ones the date has been selected from the date picker, "convert the date object to a string using Date's locale convention method, dateObject.toLocaleDateString(). Refer this for further understanding.
Upvotes: -1
Reputation: 948
This happens because, the date object for the selected date is created and is represented according to UTC standards.
Solution
You will have to do a bit of temporal calculations in order to get the expected date value. Refer this article to understand the actual working to reach the desired goal.
The simplest way, ones the date has been selected from the date picker, "convert the date object to a string using Date's locale convention method, dateObject.toLocaleDateString(). Refer this for further understanding.
example : $scope.dateOfTransactionFilter.toLocaleDateString()
Hope this helps. Cheers
Upvotes: 1