fix(growth): round X-axis week labels to 1 decimal
1.7142857142857142sem → 1.7sem Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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";
|
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 {
|
function fmtAgeWeeks(weeks: number): string {
|
||||||
if (weeks === 0) return "Naiss.";
|
const w = Math.round(weeks * 10) / 10;
|
||||||
if (weeks < 4) return `${weeks}sem`;
|
if (w === 0) return "Naiss.";
|
||||||
const months = Math.round(weeks / 4.345);
|
if (w < 4) return `${w}sem`;
|
||||||
|
const months = Math.round(w / 4.345);
|
||||||
if (months >= 12) return "1 an";
|
if (months >= 12) return "1 an";
|
||||||
return `${months}m`;
|
return `${months}m`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user