From fca4694d805ebce0c8bcef85738c160dc7e290b7 Mon Sep 17 00:00:00 2001 From: "jerome hanke (jhk)" Date: Fri, 10 Jan 2020 09:45:28 +0000 Subject: [PATCH] [FIX] mail: correct activity due date on activity view Steps to reproduce: - install crm - set your computer timezone to GMT-6 (Mexico city) - go to crm > change the view to activity view Current behavior: all activities are one day off from their actual deadline (an activity set to be due on the 7th of January shows as 6 Jan on the view) Current behavior: activities are displayed properly according to their due date opw-2162579 closes odoo/odoo#43223 X-original-commit: 0735547086aaab819369b1a08e6810baeac3783d Signed-off-by: Nicolas Martinelli (nim) --- .../mail/static/src/js/views/activity/activity_renderer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/views/activity/activity_renderer.js b/addons/mail/static/src/js/views/activity/activity_renderer.js index 480bad864e7..7e106a4418a 100644 --- a/addons/mail/static/src/js/views/activity/activity_renderer.js +++ b/addons/mail/static/src/js/views/activity/activity_renderer.js @@ -208,7 +208,10 @@ var ActivityRenderer = AbstractRenderer.extend({ var def = widget.appendTo($td).then(function () { // replace clock by closest deadline var $date = $('
'); - var date = new Date(activity_group.o_closest_deadline); + // split the year/month/day to create a date (to have a date, no tz, instead of a datetime, tz dependant) + var splitDate = activity_group.o_closest_deadline.split('-'); + // the value representing the month, ranges from 0 for January up to 11 for December. + var date = new Date(splitDate[0], splitDate[1]-1, splitDate[2]); // To remove year only if current year if (moment().year() === moment(date).year()) { $date.text(date.toLocaleDateString(moment().locale(), { day: 'numeric', month: 'short' }));