diff options
| author | Priyanka Kakadiya <pka@odoo.com> | 2020-10-06 09:56:39 +0000 |
|---|---|---|
| committer | Priyanka Kakadiya <pka@odoo.com> | 2020-10-06 09:56:47 +0000 |
| commit | a029fca2d0def06ea3f67270f0e1d654d49a0c57 (patch) | |
| tree | ad43c602870fc39828df61c37f9e478b23b32ef5 /addons/web/static/src | |
| parent | 5d3310cea75014ce3c43ee89235cd42b87e0cf99 (diff) | |
[FIX] web: send utc date to server from daterange widget
When manually updating the time on a daterange widget, the value sent to the
server is not converted to UTC and is sent as it appears on the input.
currently daterange widget send datetime value as it is, written in input field
if manually entered, so if user set 10:00:00 so while sending data it will be
send as it is 10:00:00 so when next time record reloaded after save, it will
display 15:30:00 if timezone UTC+5:30.
Instead, change the string date to moment object with current user timezone.
so that datetime send to server is UTC time and when next time it is loaded
it adds user timezone difference, so if timezone is UTC+5:30 and user enters
10:00:00 then while sending data to server it sends 04:30:00 and when displayed
again after reload it adds +5:30 timezone difference.
LINKS
PR #50132
Task 2240378
closes odoo/odoo#59208
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index efa9f522c98..e194ee6b522 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -638,6 +638,15 @@ var FieldDateRange = InputField.extend({ } this._super.apply(this, arguments); }, + /** + * Return the date written in the input, in UTC. + * + * @private + * @returns {Moment|false} + */ + _getValue: function () { + return field_utils.parse[this.formatType](this.$input.val(), this.field, { timezone: true }); + }, //-------------------------------------------------------------------------- // Private |
