admin管理员组

文章数量:1124797

I have a JavaScript Date object that is a property of an object that I want to send with an HTTP Post request.

But the problem is that it is serialized using my locale, whereas I need it to be serialized uniformly regardless of the client's locale.

I know that, internally, the toJSON() is called and that I could overwrite the Date.prototype.toJSON method but this would overwrite it everywhere, whereas I only want it done for HTTP request bodies. Is this somehow configurable somewhere?

Note: I absolutely do not want to manually serialize it. We have hundreds of post requests throughout the application, this should be default.

本文标签: Angular HTTP Post date serialization formatStack Overflow