From 08c5cf293f2b08c1997d4a6a28f584aa7ddcb525 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 30 Nov 2020 21:29:39 +0100 Subject: [PATCH] * Filemanager: Put file creation & modification times in user timezone --- filemanager/inc/class.filemanager_ui.inc.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index 9d7b8b727a..efa71d5982 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -991,6 +991,12 @@ class filemanager_ui $row['download_url'] = Vfs::download_url($path); $row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal + foreach(['mtime','ctime'] as $date_field) + { + $time = new Api\DateTime($row[$date_field],Api\DateTime::$server_timezone); + $time->setUser(); + $row[$date_field] = $time->format('ts'); + } $rows[++$n] = $row; $path2n[$path] = $n; } @@ -1408,6 +1414,14 @@ class filemanager_ui ); } + // Times are in server time, convert to user timezone + foreach(['mtime','ctime'] as $date_field) + { + $time = new Api\DateTime($content[$date_field],Api\DateTime::$server_timezone); + $time->setUser(); + $content[$date_field] = $time->format('ts'); + } + // mergeapp $content['mergeapp'] = static::get_mergeapp($path, 'self'); $content['mergeapp_parent'] = static::get_mergeapp($path, 'parents');