You are here

public function TimestampItemNormalizer::normalize in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/serialization/src/Normalizer/TimestampItemNormalizer.php \Drupal\serialization\Normalizer\TimestampItemNormalizer::normalize()

Overrides ComplexDataNormalizer::normalize

File

core/modules/serialization/src/Normalizer/TimestampItemNormalizer.php, line 27

Class

TimestampItemNormalizer
Converts values for TimestampItem to and from common formats.

Namespace

Drupal\serialization\Normalizer

Code

public function normalize($object, $format = NULL, array $context = []) {
  return parent::normalize($object, $format, $context) + [
    // 'format' is not a property on Timestamp objects. This is present to
    // assist consumers of this data.
    'format' => \DateTime::RFC3339,
  ];
}