summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2018-01-24 04:12:39 -0800
committerNicolas Martinelli <nim-odoo@users.noreply.github.com>2018-01-24 14:11:55 +0100
commit34bfadb2f2f2f57f4f72515fbc610a521e8f4619 (patch)
tree7252575797c38344512c421e2b14ae6bae6aed3f /addons/web/static/src
parentc0fa5228d8e1647413c2901728b4c05971185079 (diff)
[FIX] web: suggested date
- Set the OS to a GMT- timezone (e.g. 'America/Los Angeles') - Set the format of the date to '%d/%m/%Y' - Go to 'Account > Adviser > Journal Entries' - Type '02-01-2018' The suggested date is 31/01/2018. Setting the moment object as UTC will lead to a conversion of the date to the OS timezone when calling `toDate`, e.g.: Mon Jan 31 2018 16:00:00 GMT-0800 (PST) UTC should only be used in case of datetime, not date. opw-803466
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/search_inputs.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/search_inputs.js b/addons/web/static/src/js/views/search_inputs.js
index 6459fba77b8..91d85a1901a 100644
--- a/addons/web/static/src/js/views/search_inputs.js
+++ b/addons/web/static/src/js/views/search_inputs.js
@@ -354,7 +354,11 @@ var DateField = Field.extend(/** @lends instance.web.search.DateField# */{
}
// 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 (t === 'datetime') {
+ var m = moment.utc(v, 'YYYY-MM-DD HH:mm:ss');
+ } else {
+ var m = moment(v, 'YYYY-MM-DD');
+ }
if (!m.isValid()) { return $.when(null); }
var d = m.toDate();
var date_string = formats.format_value(d, this.attrs);