Starcounter-Jack / JSON-Patch

Lean and mean Javascript implementation of the JSON-Patch standard (RFC 6902). Update JSON documents using delta patches.
MIT License
1.79k stars 215 forks source link

JSON.stringify converts dates to UTC which may not always be desirable #222

Open cbierFL opened 5 years ago

cbierFL commented 5 years ago

When deep cloning the object to create an operation it looks like all objects are being JSON stringified. JSON.stringify converts all dates to UTC.

This is a problem if the server is giving the UI a non-utc date, and then the UI is patching that date back with a different time zone.

https://github.com/Starcounter-Jack/JSON-Patch/blob/0d6be6a09284fa694a493f39604469d082dad6d5/dist/fast-json-patch.js#L120

cbierFL commented 5 years ago

Missed the related issues / PRs: https://github.com/Starcounter-Jack/JSON-Patch/pull/2 https://github.com/Starcounter-Jack/JSON-Patch/issues/4

This one is slightly different in that it's not a big deal that its becoming a string. Just that the timezone is being changed