From f629cd9672cd22ef0e11ac839c1b500d62ab4e76 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Wed, 18 Sep 2019 15:27:06 +0000 Subject: [FIX] web: write date without separator Since fbbfa6d it's not longer possible to write a date without separator (e.g., 0102 for 01/02/2019; 121298 for 12/12/1998; 02042018 for 02/04/2018), or a date without year (e.g., 01/02 for 01/02/2019) in the datepicker widget. In this commit we have decided to be as permissive as tempus dominus that call moment.js with strict false. This allows moment.js to deduct a date from a string in a more versatile way. This also allows a more versatile autocomplete in the search views. opw-2070464 opw-2070931 closes odoo/odoo#37095 Forward-port-of: odoo/odoo#36821 Signed-off-by: Lucas Perais (lpe) --- addons/web/static/src/js/fields/field_utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js/fields/field_utils.js') diff --git a/addons/web/static/src/js/fields/field_utils.js b/addons/web/static/src/js/fields/field_utils.js index ec99f4fa0f6..fd73b7a9ed2 100644 --- a/addons/web/static/src/js/fields/field_utils.js +++ b/addons/web/static/src/js/fields/field_utils.js @@ -415,7 +415,7 @@ function parseDate(value, field, options) { if (options && options.isUTC) { date = moment.utc(value); } else { - date = moment.utc(value, [datePattern, datePatternWoZero, moment.ISO_8601], true); + date = moment.utc(value, [datePattern, datePatternWoZero, moment.ISO_8601]); } if (date.isValid()) { if (date.year() === 0) { @@ -459,7 +459,7 @@ function parseDateTime(value, field, options) { // phatomjs crash if we don't use this format datetime = moment.utc(value.replace(' ', 'T') + 'Z'); } else { - datetime = moment.utc(value, [pattern1, pattern2, moment.ISO_8601], true); + datetime = moment.utc(value, [pattern1, pattern2, moment.ISO_8601]); if (options && options.timezone) { datetime.add(-session.getTZOffset(datetime), 'minutes'); } -- cgit v1.2.3