I need to be able to store the selected date value as date without time in my ng-model.
Here is my view:
<script type="text/ng-template" id="form_field_datetime">
<h3 style="color:coral ;">{{field.displayName}}</h3>
<br />
<div>
<div ng-controller="dateCtrl">
<p class="input-group">
<input type="text" class="form-control" datepicker-popup="{{format}}" is-open="opened" ng-required="true" ng-model="field.theValues[0]" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
</div>
</div>
</script>
On selection of the date shown above the stored value in my ng-model is :
2012-03-12T22:00:00.000Z
I need:
2012-03-13
Here is the controller(pretty much as in example):
app.controller('dateCtrl', ['$scope',
function ($scope) {
$scope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened = true;
};
$scope.dateOptions = {
formatYear: 'yy',
startingDay: 0
};
$scope.formats = ['yyyy-MM-dd', 'dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
$scope.format = $scope.formats[0];
}
]);
How to go around this?