DataDefinitionTimestampNormalizer.php in JSON:API Schema 8
File
src/Normalizer/DataDefinitionTimestampNormalizer.php
View source
<?php
namespace Drupal\jsonapi_schema\Normalizer;
use Drupal\Core\TypedData\DataDefinitionInterface;
class DataDefinitionTimestampNormalizer extends DataDefinitionNormalizer {
protected $supportedDataTypes = [
'timestamp',
];
protected function extractPropertyData(DataDefinitionInterface $property, array $context = []) {
$value = parent::extractPropertyData($property);
$value['type'] = 'number';
$value['format'] = 'utc-millisec';
return $value;
}
}