Skip to content
Permalink
Browse files

[FIX] web: format date without locale

moment().locale('en').format('YYYY-MM-DD')
"2019-03-25"
moment().locale('ar').format('YYYY-MM-DD')
"٢٠١٩-٠٣-٢٥"
moment().locale('my').format('YYYY-MM-DD')
"၂၀၁၉-၀၃-၂၅"

Was rejected as a valid bug at moment/moment#4448
Apply the same logic than 109b319

Fixes #32081
  • Loading branch information...
mart-e committed Mar 25, 2019
1 parent a4f9b48 commit 142041f037fa3d7a23bafb939dc21f5db6c56f05
Showing with 5 additions and 1 deletion.
  1. +5 −1 addons/web/static/src/js/views/calendar/calendar_controller.js
@@ -19,6 +19,10 @@ var QuickCreate = require('web.CalendarQuickCreate');
var _t = core._t;
var QWeb = core.qweb;

function dateToServer (date) {
return date.clone().utc().locale('en').format('YYYY-MM-DD HH:mm:ss');
}

var CalendarController = AbstractController.extend({
custom_events: _.extend({}, AbstractController.prototype.custom_events, {
changeDate: '_onChangeDate',
@@ -236,7 +240,7 @@ var CalendarController = AbstractController.extend({

for (var k in context) {
if (context[k] && context[k]._isAMomentObject) {
context[k] = context[k].clone().utc().format('YYYY-MM-DD HH:mm:ss');
context[k] = dateToServer(context[k]);
}
}

0 comments on commit 142041f

Please sign in to comment.
You can’t perform that action at this time.