[FIX] web: date autocompletion should use user's locale
search bar does not suggest date field format based on user's locale and always shows based on mmddyy using Date.parse, opw:615276 Note: starting in 9.0, datejs has been replaced by momentjs, so this problem should be solved in a better way.
This commit is contained in:
parent
16900c8ac4
commit
69d60465ee
|
@ -1497,7 +1497,11 @@ instance.web.search.DateField = instance.web.search.Field.extend(/** @lends inst
|
||||||
return instance.web.date_to_str(facetValue.get('value'));
|
return instance.web.date_to_str(facetValue.get('value'));
|
||||||
},
|
},
|
||||||
complete: function (needle) {
|
complete: function (needle) {
|
||||||
var d = Date.parse(needle);
|
try {
|
||||||
|
var d = instance.web.str_to_date(instance.web.parse_value(needle, {'widget': 'date'}));
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!d) { return $.when(null); }
|
if (!d) { return $.when(null); }
|
||||||
var date_string = instance.web.format_value(d, this.attrs);
|
var date_string = instance.web.format_value(d, this.attrs);
|
||||||
var label = _.str.sprintf(_.str.escapeHTML(
|
var label = _.str.sprintf(_.str.escapeHTML(
|
||||||
|
|
Loading…
Reference in New Issue