Reputation: 77
When i am binding date with angular model, the model variable gives value which is 1 day less from i actually selected, please see the code
<!DOCTYPE html>
<html>
<head>
<script data-require="[email protected]" data-semver="1.3.0-beta.5" src="https://code.angularjs.org/1.3.0-beta.5/angular.js"></script>
<script data-require="ui-bootstrap@*" data-semver="0.11.0" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.min.js"></script>
</head>
<body ng-app="app">
<input type="date" ng-model="ddd">
{{ddd}}
</body>
Upvotes: 1
Views: 1631
Reputation: 847
Actually it is returning the correct date. To display correctly do
<input type="date" ng-model="ddd">
{{ddd | date:'MM/dd/yyyy'}}
Here {{ddd}} shows just the date object. You have to filter it into correct format to display correctly
Upvotes: 1