[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
This commit is contained in:
Nicolas Martinelli
2018-01-24 14:11:55 +01:00
committed by Nicolas Martinelli
parent c0fa5228d8
commit 34bfadb2f2
@@ -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);