The following situation:
I have a form with a field input[date]
. I convert the values with the following code:
$scope.entity.date = $filter('date')($scope.entity.date, 'yyyy-MM-dd');
This correctly formats the date, for example. 2015-10-27
When I submit an object using $http.post
angular, it seems to recognize this as a date and reformat it before 2015-09-30T23:00:00.000Z
. I am in Germany and we have GMT + 1. Thus, angular converts the date to GMT. Is there any way to disable this behavior?
Edit:
HTML code:
<form ng-submit="submit()">
<input type="date" ng-model="entity.date" />
</form>
JS code:
$scope.submit = function() {
$scope.entity.date = $filter('date')($scope.entity.date, 'yyyy-MM-dd');
$http({
data: $scope.entity,
method: POST,
url: '/resource'
})
.success(function(data) {
});
};
Benny source
share