0

I'm doing a HTTP get request, in my AngularJS controller, but I don't know why, my date in my Model is different from the date in the Query String generated:

$scope.modalSave = function() {
  console.log("modalSave:", $scope.modal);
  // prints the correct date: 2015-10-16 00:00

  $http.get('/Planner/Save', {
    params: {
      id: $scope.modal.Id,
      date: $scope.modal.Date //wrong date: 2015-10-15 23:00
    }
  });
}
4
  • 2
    Make jsfiddle example... Commented Oct 16, 2015 at 14:59
  • try console.log("modalSave:", $scope.modal.Date); are you get same result? Commented Oct 16, 2015 at 15:00
  • console.log("modalSave:", $scope.modal) prints the correct date: 2015-10-16 00:00 Commented Oct 17, 2015 at 9:04
  • @SarjanDesai, I could do a jsfiddle example, but I had this on Azure working correctly and the problem appear when I change to a new host Commented Oct 17, 2015 at 9:05

1 Answer 1

1

Looks like a typical UTC date problem. The server on which the server is could have a different date set so it is returning a "wrong" values. I would double check the date on the service side.

Sign up to request clarification or add additional context in comments.

1 Comment

I agree, but I don't understand why when I do 'new Date()' I get the right date, but when I pass it to ajax request, it changes it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.