Skip to content
Snippets Groups Projects
Commit 922a52dc authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[FIX] web: date autocompletion should not harcode 'date'

But should use date or datetime according to the widget type

This fix is related to 69d60465
parent 0a7633c1
No related branches found
No related tags found
No related merge requests found
......@@ -1497,10 +1497,18 @@ instance.web.search.DateField = instance.web.search.Field.extend(/** @lends inst
return instance.web.date_to_str(facetValue.get('value'));
},
complete: function (needle) {
var d;
try {
var d = instance.web.str_to_date(instance.web.parse_value(needle, {'widget': 'date'}));
var t = (this.attrs && this.attrs.type === 'datetime') ? 'datetime' : 'date';
var v = instance.web.parse_value(needle, {'widget': t});
if (t === 'datetime'){
d = instance.web.str_to_datetime(v);
}
else{
d = instance.web.str_to_date(v);
}
} catch (e) {
return false;
// pass
}
if (!d) { return $.when(null); }
var date_string = instance.web.format_value(d, this.attrs);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment