Drupal stores datetime fields in UTC time with no timezone identifier. For instance, for a site in Eastern Time, the datetime 10/31/2017 - 5:30AM will be stored as 2017-10-31T09:30:00
This violates ISO 8601:
If no UTC relation information is given with a time representation, the time is assumed to be in local time
This becomes problematic if data is ever exported from Drupal. For instance, external apps consuming data via JSON API would never expect a datetime formatted like that to be in UTC (unless the hosting site just happened to be in that timezone): #2913941: [PP-1] Fields using the DateTimeIso8601 @DataType are missing an explicit time zone: missing a normalizer
If Drupal is going to store dates in UTC, it should append the timezone to comply with ISO 8601, i.e. 2017-10-31T09:30:00Z
Comments
Comment #2
Dane Powell CreditAttribution: Dane Powell at Acquia commentedComment #3
Dane Powell CreditAttribution: Dane Powell at Acquia commentedComment #4
mpdonadioYup. #2716891: DateTimeIso8601::setDateTime() vs. DateTimeItem::schema(): (at least) one of them is broken is probably the closest dup and the root cause, but there is also #2632040: [PP-1] Add ability to select a timezone for datetime field.
We have #2867206: API-First DX of "date" and "date range" fields: add 'datetime_iso8601' @DataType (de)normalizer using RFC3339 timestamps with timezones, but I don't recall right now why that doesn't include a normalizer, too.
However, I think there is an issue about #2860350: Document why JSON API only supports @DataType-level normalizers for the specific use case mentioned in the IS about JSONAPI.