javascript - Using AngularJS date filter with UTC date doesn't work with get method -
i have utc date passing angular's date filter convert local time zone after submitting form , still in same page bellow :
$scope.xservice.update($scope.id, $scope.model).success(function (data, status, headers, config) { $scope.addalert("success", "opération terminée avec succès"); var mydate1 = data.startdatetimeutc; var mydate2 = data.enddatetimeutc; data.startdatetimeutc = $filter('date')(new date(mydate1), 'dd/mm/yyyy hh:mm'); data.enddatetimeutc = $filter('date')(new date(mydate2), 'dd/mm/yyyy hh:mm'); $scope.model = data; alert($scope.model.publishstartdatetimeutc); alert($scope.model.publishenddatetimeutc); }).error(function (data, status, headers, config) { $scope.addalert("danger", data); });
this work me , dates converted local time zone problem converting code doesn't work me in method bellow :
$scope.xservice.get($scope.id).success(function (data, status, headers, config) { var mydate1 = $scope.model.startdatetimeutc; var mydate2 = $scope.model.enddatetimeutc; $scope.model.startdatetimeutc = $filter('date')(new date(mydate1), 'dd/mm/yyyy hh:mm'); $scope.model.enddatetimeutc = $filter('date')(new date(mydate2), 'dd/mm/yyyy hh:mm'); $scope.model = data; alert($scope.model.enddatetimeutc); alert($scope.model.startdatetimeutc); console.info("advertisning model", $scope.model); $scope.model.id = $scope.advertisementid; $scope.newcreate = false; }).error(function (data, status, headers, config) { }); }
it return utc dates saved in bd , problem??
Comments
Post a Comment