Change record status: 
Project: 
Introduced in branch: 
8.x-2.x
Introduced in version: 
8.x-2.0
Description: 

In a nutshell: follow the example of core REST, and the upcoming recommendation from the JSON API spec.

Time fields: RFC3339 (a more specific version of ISO8601 datetime formatting)
From:
  "changed": 123456789,

to

  "changed": "1973-11-29T21:33:09+00:00",
Date-only fields: ISO8601
  "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!

Impacts: 
Site builders, administrators, editors
Module developers
Themers

Comments

siva01’s picture

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.