[FIX] spreadsheet: use localized week start

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) <lul@odoo.com>
This commit is contained in:
Lucas Lefèvre
2023-07-04 07:55:08 +02:00
committed by Lucas Lefèvre (lul)
parent c373be77b6
commit e136b43e9b
@@ -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" },