From e136b43e9b8d6730432deaf7a71bdc74b18cc7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Fri, 16 Jun 2023 14:55:49 +0000 Subject: [PATCH] [FIX] spreadsheet: use localized week start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: Go to CRM pivot view, group create_date by week, insert into spreadsheet. => week numbers are offset by one (W23 instead of W24) Since 3a177c448, `read_group` returns week aggregates according to the user's language first day (e.g Sunday for en_US, Monday for fr_FR). Before the commit, it was always Monday (ISO week start). This commit changes the moment formats from "W" (Week of Year (ISO)) to "w" which is the localized week of year*. Note there can still be some inconsistencies if the browser language is different than the user's language. This hasn't changed and is a regular known issue. * https://momentjscom.readthedocs.io/en/latest/moment/04-displaying/01-format/ opw-3372581 closes odoo/odoo#127089 X-original-commit: c5738479dc1c1879a9ac0169e1ec87eb5098c525 Related: odoo/enterprise#43516 Signed-off-by: Lucas Lefèvre (lul) --- addons/spreadsheet/static/src/helpers/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/spreadsheet/static/src/helpers/constants.js b/addons/spreadsheet/static/src/helpers/constants.js index 1ea8d21c877..6a07ce36fef 100644 --- a/addons/spreadsheet/static/src/helpers/constants.js +++ b/addons/spreadsheet/static/src/helpers/constants.js @@ -6,7 +6,7 @@ export const DEFAULT_LINES_NUMBER = 20; export const FORMATS = { day: { out: "MM/DD/YYYY", display: "DD MMM YYYY", interval: "d" }, - week: { out: "WW/YYYY", display: "[W]W YYYY", interval: "w" }, + week: { out: "ww/YYYY", display: "[W]w YYYY", interval: "w" }, month: { out: "MM/YYYY", display: "MMMM YYYY", interval: "M" }, quarter: { out: "Q/YYYY", display: "[Q]Q YYYY", interval: "Q" }, year: { out: "YYYY", display: "YYYY", interval: "y" },