fix(experimentAnalysis): use ISO week start (Monday) consistently in aggregateWeeklyMetrics

- Change getWeekStartSunday to getISOWeekMonday for timestamp calculation
- Ensures week alignment between data aggregation and ISO week range calculation
- Fixes incorrect treatment_after average calculation

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Christian Vidal Wolf
2026-02-26 15:21:21 +01:00
co-authored by Qwen-Coder
parent d5936f1301
commit 918da227ee
+2 -1
View File
@@ -148,9 +148,10 @@ function aggregateWeeklyMetrics(
const key = `${year}-W${String(weekNum).padStart(2, '0')}`;
if (!weeklyMap.has(key)) {
// Use ISO week start (Monday) instead of Sunday for consistency
weeklyMap.set(key, {
week: key,
timestamp: getWeekStartSunday(year, weekNum),
timestamp: getISOWeekMonday(year, weekNum),
units: 0,
revenue: 0,
adRevenue: 0,