summaryrefslogtreecommitdiff
path: root/addons/web/static
diff options
context:
space:
mode:
authorHarshad Modi <hmo@odoo.com>2017-05-23 14:04:08 +0530
committerged-odoo <ged@odoo.com>2017-05-23 10:34:08 +0200
commit109b319d643b439ba279ececa41b0983baece9c2 (patch)
tree49aba116bf5f5401e604d864aa00b4ca658fbb11 /addons/web/static
parent12bf5bb92665f81e9df8e918b130e86356f61052 (diff)
[FIX] web: send date string in server compatible format
Languages like Arabic (ar_SY), Hindi(hi_IN) do not use english digits to describe dates, and moment.js format function will keep these characters. So, the server will get date strings, and will be unable to use them. To see the problem, just type moment().locale('ar_SY').format('YYYY-MM-DD') into a browser console. In this commit, we simply force the locale to 'en' before sending data to the server. PR #17156
Diffstat (limited to 'addons/web/static')
-rw-r--r--addons/web/static/src/js/fields/field_utils.js4
-rw-r--r--addons/web/static/src/js/views/calendar/calendar_model.js2
2 files changed, 3 insertions, 3 deletions
diff --git a/addons/web/static/src/js/fields/field_utils.js b/addons/web/static/src/js/fields/field_utils.js
index aabf5e2ae95..0606af0d662 100644
--- a/addons/web/static/src/js/fields/field_utils.js
+++ b/addons/web/static/src/js/fields/field_utils.js
@@ -347,7 +347,7 @@ function parseDate(value, field, options) {
}
if (date.year() >= 1900) {
date.toJSON = function () {
- return this.format('YYYY-MM-DD');
+ return this.clone().locale('en').format('YYYY-MM-DD');
};
return date;
}
@@ -394,7 +394,7 @@ function parseDateTime(value, field, options) {
}
if (datetime.year() >= 1900) {
datetime.toJSON = function () {
- return this.format('YYYY-MM-DD HH:mm:ss');
+ return this.clone().locale('en').format('YYYY-MM-DD HH:mm:ss');
};
return datetime;
}
diff --git a/addons/web/static/src/js/views/calendar/calendar_model.js b/addons/web/static/src/js/views/calendar/calendar_model.js
index 64eae1f746a..939e44446a8 100644
--- a/addons/web/static/src/js/views/calendar/calendar_model.js
+++ b/addons/web/static/src/js/views/calendar/calendar_model.js
@@ -16,7 +16,7 @@ var scales = [
];
function dateToServer (date) {
- return date.clone().utc().format('YYYY-MM-DD HH:mm:ss');
+ return date.clone().utc().locale('en').format('YYYY-MM-DD HH:mm:ss');
}
return AbstractModel.extend({