1

I use AngularJS for my appl and also the $http- provider. I have a problem with the dateTime. I create da date with javaScript (var date = new Date() e.g. 2016-03-09 00:00) and if I will send this date (in object ParameterObject) to backend over $http one hour is subtract (2016-03-08 23:00+01:00). I will prevent this. Does anyone know how, is there e.g. a flag for $http?

return $http.post(baseURL + '/restServiceURL/', ParameterObject).success(function(data) {...
1
  • 1
    Timezone difference between the server and your local machine? Commented Mar 9, 2016 at 8:01

1 Answer 1

2

you need to add the following code to your js:

Date.prototype.toJSON = function () { return this.toLocaleString(); }
Sign up to request clarification or add additional context in comments.

2 Comments

Is this a global setting in my javascript?
yes, it is! you can add your code and then have a try!

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.