[FIX] web: use language week_start in datepickers
Before this rev., if the week_start param (the first day of week) of the user language was changed, it wasn't reflected on datepickers (however, it worked fine in the calendar view). This rev. makes this work by updating the moment locale with the corresponding param. Fixes #36450 Closes #36532 closes odoo/odoo#38472 X-original-commit: eeb518316f25d652bea3ec6d387db6ad93284fb2 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
@@ -207,6 +207,8 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
|
||||
}
|
||||
return loaded.then(function () {
|
||||
return self.load_js(file_list);
|
||||
}).then(function () {
|
||||
self._configureLocale();
|
||||
});
|
||||
},
|
||||
load_translations: function () {
|
||||
@@ -361,6 +363,23 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
|
||||
location.reload();
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sets first day of week in current locale according to the user language.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_configureLocale: function () {
|
||||
moment.updateLocale(moment.locale(), {
|
||||
week: {
|
||||
dow: (_t.database.parameters.week_start || 0) % 7,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Handlers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user