[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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user