[FIX] mail: format date tracking values according to the locale

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) <wil@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Louis Wicket (wil)
2023-07-07 20:24:58 +02:00
parent 0304df6dff
commit ced4efa612
@@ -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": {