diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index f9c45dea58..a295db6b5f 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -3108,6 +3108,37 @@ class calendar_uiforms extends calendar_ui // custom fields are now "understood" directly by historylog widget } + /** + * Modify history to make timestamps in user time + * + * @param array $data values for keys "data" (data) and "args": + * values for keys "value", "rows" (reference) and "total" (reference) + */ + public function modify_history(array $data) + { + $history = []; + $sel_options = []; + $this->setup_history($history, $sel_options); + foreach($data['rows'] as $index => &$row) + { + if($row['appname'] !== 'calendar') + { + return; + } + if(str_contains($history['history']['status-widgets'][$row['status']], 'date')) + { + foreach(['old_value', 'new_value'] as $field) + { + if(!$row[$field]) + { + continue; + } + $row[$field] = Api\DateTime::server2user($row[$field], Api\DateTime::ET2); + } + } + } + } + /** * moves an event to another date/time * diff --git a/calendar/setup/setup.inc.php b/calendar/setup/setup.inc.php index 97c5305354..9a54661e95 100644 --- a/calendar/setup/setup.inc.php +++ b/calendar/setup/setup.inc.php @@ -47,6 +47,7 @@ $setup_info['calendar']['hooks']['categories'] = 'calendar_hooks::categories'; $setup_info['calendar']['hooks']['mail_import'] = 'calendar_hooks::mail_import'; $setup_info['calendar']['hooks']['notifications_actions'] = 'calendar_hooks::notifications_actions'; $setup_info['calendar']['hooks']['etemplate2_register_widgets'] = 'calendar_hooks::widgets'; +$setup_info['calendar']['hooks']['etemplate2_history_get_rows'] = 'calendar.calendar_uiforms.modify_history'; /* Dependencies for this app to work */ $setup_info['calendar']['depends'][] = array(