protected property DateTimeIso8601Normalizer::$allowedFormats in Drupal 9
Same name and namespace in other branches
- 8 core/modules/serialization/src/Normalizer/DateTimeIso8601Normalizer.php \Drupal\serialization\Normalizer\DateTimeIso8601Normalizer::allowedFormats
Allowed datetime formats for the denormalizer.
The list is chosen to be unambiguous and language neutral, but also common for data interchange.
Type: string[]
Overrides DateTimeNormalizer::$allowedFormats
See also
http://php.net/manual/en/datetime.createfromformat.php
File
- core/
modules/ serialization/ src/ Normalizer/ DateTimeIso8601Normalizer.php, line 20
Class
- DateTimeIso8601Normalizer
- Converts values for the DateTimeIso8601 data type to RFC3339.
Namespace
Drupal\serialization\NormalizerCode
protected $allowedFormats = [
'RFC 3339' => \DateTime::RFC3339,
'ISO 8601' => \DateTime::ISO8601,
// @todo Remove this in https://www.drupal.org/project/drupal/issues/2958416.
// RFC3339 only covers combined date and time representations. For date-only
// representations, we need to use ISO 8601. There isn't a constant on the
// \DateTime class that we can use, so we have to hardcode the format.
// @see https://en.wikipedia.org/wiki/ISO_8601#Calendar_dates
// @see \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATE_STORAGE_FORMAT
'date-only' => 'Y-m-d',
];