From 47ce4a3623f493e719fced42cade11ceac22ef08 Mon Sep 17 00:00:00 2001 From: visp-odoo Date: Fri, 12 Jan 2024 15:41:01 +0530 Subject: [PATCH] [FIX] web_editor: wrong time in history of changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit: When a user edits an article and selects the restore button to revert to a previous version, the displayed time is incorrect because it shows universal time instead of the user's timezone. After this commit: When a user edits an article and utilizes the restore button to revert to a previous version, the timestamp will now reflect the time in the user's current timezone. task-3641579 closes odoo/odoo#149177 Signed-off-by: Geelen Sébastien (sge) --- .../static/src/components/history_dialog/history_dialog.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/components/history_dialog/history_dialog.js b/addons/web_editor/static/src/components/history_dialog/history_dialog.js index 84161c66b8e..cfb93bbc68f 100644 --- a/addons/web_editor/static/src/components/history_dialog/history_dialog.js +++ b/addons/web_editor/static/src/components/history_dialog/history_dialog.js @@ -32,6 +32,7 @@ class HistoryDialog extends Component { this.size = 'xl'; this.title = _t('History'); this.orm = useService('orm'); + this.userService = useService('user'); onMounted(() => this.init()); } @@ -90,7 +91,7 @@ class HistoryDialog extends Component { * Getters **/ getRevisionDate(revision) { - return formatDateTime(DateTime.fromISO(revision['create_date'])); + return formatDateTime(DateTime.fromISO(revision['create_date'], { zone: 'utc' }).setZone(this.userService.tz)); } }