From 0a5e138b32103cbdbbc826b223ff6f7e10b04e40 Mon Sep 17 00:00:00 2001 From: maad-odoo Date: Tue, 12 Sep 2023 05:36:25 +0000 Subject: [PATCH] [FIX] mail: activities creation date according to user timezone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit: When any activity was created, the displayed created date was in UTC time and not adjusted to the user's timezone. The time was not converted according to the user's timezone. After this commit: The activity's created time now displayed is converted from the UTC time stored during the activity's creation. task-3483695 closes odoo/odoo#137684 X-original-commit: d016456c72d7927c10120a556adce9e73227523a Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/core/web/activity.js | 7 +++++++ addons/mail/static/src/core/web/activity.xml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/core/web/activity.js b/addons/mail/static/src/core/web/activity.js index d509ce91ebe..4b3176213b2 100644 --- a/addons/mail/static/src/core/web/activity.js +++ b/addons/mail/static/src/core/web/activity.js @@ -9,6 +9,7 @@ import { AvatarCardPopover } from "@mail/discuss/web/avatar_card/avatar_card_pop import { Component, onMounted, onWillUnmount, useState } from "@odoo/owl"; import { browser } from "@web/core/browser/browser"; +import { deserializeDateTime } from "@web/core/l10n/dates"; import { _t } from "@web/core/l10n/translation"; import { usePopover } from "@web/core/popover/popover_hook"; import { useService } from "@web/core/utils/hooks"; @@ -50,6 +51,12 @@ export class Activity extends Component { return this.props.data.display_name; } + get displayCreateDate() { + return deserializeDateTime(this.props.data.create_date).toLocaleString( + luxon.DateTime.DATETIME_SHORT_WITH_SECONDS + ); + } + updateDelayAtNight() { browser.clearTimeout(this.updateDelayMidnightTimeout); this.updateDelayMidnightTimeout = browser.setTimeout( diff --git a/addons/mail/static/src/core/web/activity.xml b/addons/mail/static/src/core/web/activity.xml index b3e3cdd0ccd..e0d3ea74c47 100644 --- a/addons/mail/static/src/core/web/activity.xml +++ b/addons/mail/static/src/core/web/activity.xml @@ -32,7 +32,7 @@ - +
Activity type
Created by
Created by
Assigned to
Due on