- Issue created by @imclean
- 🇺🇦Ukraine gilmord 🇺🇦Ukraine
Maybe better alter it on the step of storing field data to the fields table?
while there is no MR/patch this works:
/** * Implements hook_google_analytics_reports_field_import(). */ function YOUR_MODULE_google_analytics_reports_field_import_alter(array &$field) { if ($field['gaid'] === 'date') { $field['data_type'] = 'string'; } }
- 🇦🇺Australia imclean Tasmania
A another approach is to convert the format to a timestamp and leave the data_type as it is. This allows you to select the date display format within the view.
/** * Implements hook_views_post_execute(). * * @param ViewExecutable $view */ function MY_MODULE_views_post_execute(ViewExecutable $view) { if ($view->id() === 'VIEW_ID' ) { foreach ($view->result as &$result) { $result->date = strtotime($result->date); } } }