From 319d70c3a42d9b61de10727e8ae2f90694d10d36 Mon Sep 17 00:00:00 2001 From: Arnaud Nelissen Date: Fri, 19 Jun 2026 11:24:24 +0200 Subject: [PATCH] fix(growth): round X-axis week labels to 1 decimal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.7142857142857142sem → 1.7sem Co-Authored-By: Claude Sonnet 4.6 --- src/app/(app)/growth/page.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/(app)/growth/page.tsx b/src/app/(app)/growth/page.tsx index df03f9d..982b58b 100644 --- a/src/app/(app)/growth/page.tsx +++ b/src/app/(app)/growth/page.tsx @@ -104,9 +104,10 @@ function buildSimpleChartData(logs: GrowthLog[], baby: BabyShape, field: "height const inputCls = "w-full px-3 py-2.5 rounded-lg border border-slate-200 dark:border-slate-700 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100"; function fmtAgeWeeks(weeks: number): string { - if (weeks === 0) return "Naiss."; - if (weeks < 4) return `${weeks}sem`; - const months = Math.round(weeks / 4.345); + const w = Math.round(weeks * 10) / 10; + if (w === 0) return "Naiss."; + if (w < 4) return `${w}sem`; + const months = Math.round(w / 4.345); if (months >= 12) return "1 an"; return `${months}m`; }