From ced4efa612e1819980da8746f19fae9bb8b14cdd Mon Sep 17 00:00:00 2001 From: "Louis Wicket (wil)" Date: Fri, 7 Jul 2023 14:19:26 +0000 Subject: [PATCH] [FIX] mail: format date tracking values according to the locale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prior to this commit, date tracking values in Chatter were always formatted using the LL/dd/yyyy format. After this commit, date tracking values will be formatted according to the user's locale, so as not to cause discrepancies with other dates. closes odoo/odoo#127834 X-original-commit: 865522e0925fbeae14f5f83d3a2d69a54b546b04 Signed-off-by: Louis Wicket (wil) Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/core/web/message_patch.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/mail/static/src/core/web/message_patch.js b/addons/mail/static/src/core/web/message_patch.js index 39f9232eadf..64ec5f961af 100644 --- a/addons/mail/static/src/core/web/message_patch.js +++ b/addons/mail/static/src/core/web/message_patch.js @@ -17,6 +17,7 @@ patch(Message.prototype, "mail/core/web", { setup() { this._super(...arguments); this.action = useService("action"); + this.userService = useService("user"); }, get authorText() { return this.hasAuthorClickable ? _t("Open profile") : undefined; @@ -72,9 +73,9 @@ patch(Message.prototype, "mail/core/web", { return format.char(trackingValue.value); case "date": if (trackingValue.value) { - return luxon.DateTime.fromISO(trackingValue.value, { setZone: "utc" }).toFormat( - "LL/dd/yyyy" - ); + return luxon.DateTime.fromISO(trackingValue.value, { zone: "utc" }) + .setZone("system") + .toLocaleString({ locale: this.userService.lang.replace("_", "-") }); } return format.date(trackingValue.value); case "datetime": {