protected function DateTimeEnhancer::doTransform in JSON:API Extras 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/jsonapi/FieldEnhancer/DateTimeEnhancer.php \Drupal\jsonapi_extras\Plugin\jsonapi\FieldEnhancer\DateTimeEnhancer::doTransform()
File
- src/
Plugin/ jsonapi/ FieldEnhancer/ DateTimeEnhancer.php, line 37
Class
- DateTimeEnhancer
- Perform additional manipulations to timestamp fields.
Namespace
Drupal\jsonapi_extras\Plugin\jsonapi\FieldEnhancerCode
protected function doTransform($data, Context $context) {
$date = new \DateTime($data);
return (int) $date
->format('U');
}