[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.
This commit is contained in:
Aaron Bohy
2017-11-13 14:07:40 +01:00
parent fa5ee6ed26
commit 9bea735145
@@ -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);