diff options
| author | fw-bot <otis@odoo.com> | 2019-10-10 13:10:08 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-10-11 09:15:43 +0000 |
| commit | 3a2c69edbf4015107d5e68104e1c28bf74fcd1d8 (patch) | |
| tree | 2d4ea3794a8d6b002417f1b1d188fabb0e5cc8c7 /addons/web/static/src/js/core/session.js | |
| parent | b33f98d81f10209420bf8f0f6f377b76a168319a (diff) | |
[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>
Diffstat (limited to 'addons/web/static/src/js/core/session.js')
| -rw-r--r-- | addons/web/static/src/js/core/session.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/web/static/src/js/core/session.js b/addons/web/static/src/js/core/session.js index 09d765fbc5b..4c8a63dbdb5 100644 --- a/addons/web/static/src/js/core/session.js +++ b/addons/web/static/src/js/core/session.js @@ -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 () { @@ -362,6 +364,23 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { }, //-------------------------------------------------------------------------- + // 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 //-------------------------------------------------------------------------- |
