In a nutshell: follow the example of core REST, and the upcoming recommendation from the JSON API spec.
"changed": 123456789,
to
"changed": "1973-11-29T21:33:09+00:00",
"changed": 123456789,
to
"changed": "1973-11-29",
For JS code, this means you'll want to change
var date = value ? new Date(value * 1000) : null;
to:
var date = value ? new Date(value) : null;
Why default to RFC3339? Because it's the date & time representation standard on the internet. It is the more precise/strict successor to ISO8601 (technically, it's a profile of ISO8601). Quoting RFC 3339's introduction:
Date and time formats cause a lot of confusion and interoperability problems on the Internet. This document addresses many of the problems encountered and makes recommendations to improve consistency and interoperability when representing and using date and time in Internet protocols.
This document includes an Internet profile of the ISO8601 standard for representation of dates and times using the Gregorian calendar.
Note that you can send ISO8601 or RFC3339 timestamps using any timezone; we'll convert them to UTC before saving. That's why this prevents the annoying/unpleasant surprise experienced by many!
Comments
Timestamp is valid value
This change is strange. I must write custom module, which reverting this changes, because our frontend using timestamp and we must delivery same JSON format forever. It doesn't make sense changing JSON structure/data after every update.