fix: resolve UTC date matching and implement per-product ASIN breakdown table for Line experiments

This commit is contained in:
Christian Vidal Wolf
2026-02-21 19:37:07 +01:00
parent 8bd78c2e7f
commit aa9a7845b7
3 changed files with 181 additions and 13 deletions
+7 -2
View File
@@ -232,8 +232,13 @@ export const calculateExperimentPerformance = async (
experiment_acos: number;
actual_lift_percent: number;
}> => {
const startDate = new Date(experiment.start_date);
const endDate = experiment.end_date ? new Date(experiment.end_date) : new Date();
const parseLocalDate = (dateStr: string) => {
const [y, m, d] = dateStr.split('T')[0].split('-');
return new Date(Number(y), Number(m) - 1, Number(d));
};
const startDate = parseLocalDate(experiment.start_date);
const endDate = experiment.end_date ? parseLocalDate(experiment.end_date) : new Date();
// Calculate baseline period (same duration before experiment)
const durationMs = endDate.getTime() - startDate.getTime();