From 9bea73514554a92dff65ca90a600a7be6ee7b009 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 13 Nov 2017 14:05:09 +0100 Subject: [PATCH] [FIX] web: search view: autocomplete on datetime fields ... gives wrong values due to the timezone. For instance, let's assume that the browser timezone of the user is UTC+2, and the user types 10/09/2017 10:00:00 in a searchview with a datetime field in its arch (i.e. which autocompletes on a datatime field). Before this rev., the suggested value was 10/09/2017 08:00:00, i.e. the timezone offset was substracted from the value. --- addons/web/static/src/js/views/search_inputs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/search_inputs.js b/addons/web/static/src/js/views/search_inputs.js index edeffd874b0..e8b2c87baae 100644 --- a/addons/web/static/src/js/views/search_inputs.js +++ b/addons/web/static/src/js/views/search_inputs.js @@ -351,7 +351,8 @@ var DateField = Field.extend(/** @lends instance.web.search.DateField# */{ return $.when(null); } - var m = moment(v, t === 'datetime' ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'); + // THIS SHOULD BE FORWARDPORTED UP TO SAAS-15, NOT LATER + var m = moment.utc(v, t === 'datetime' ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'); if (!m.isValid()) { return $.when(null); } var d = m.toDate(); var date_string = formats.format_value(d, this.attrs);