From 1a913aabfb443fcfab56860595312560e8c49833 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Sun, 2 Aug 2026 20:45:24 +0530 Subject: [PATCH] fix: code quality and safety improvements --- src/app/api/goals/route.ts | 2 +- src/components/GoalTracker.tsx | 2 +- src/lib/digest-email.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/api/goals/route.ts b/src/app/api/goals/route.ts index 0d616ebd3..b4b83346b 100644 --- a/src/app/api/goals/route.ts +++ b/src/app/api/goals/route.ts @@ -239,7 +239,7 @@ try { let safeDeadline: string | null = null; if (typeof deadline === "string") { const d = new Date(deadline); - if (!isNaN(d.getTime())) { + if (!Number.isNaN(d.getTime())) { d.setUTCHours(23, 59, 59, 999); safeDeadline = d.toISOString(); } diff --git a/src/components/GoalTracker.tsx b/src/components/GoalTracker.tsx index d2eecbe22..a643a64f6 100644 --- a/src/components/GoalTracker.tsx +++ b/src/components/GoalTracker.tsx @@ -1064,7 +1064,7 @@ function ConfettiBurst() { id: i, x: Math.cos(angle) * distance, y: Math.sin(angle) * distance - 20, - color: colors[Math.random() * colors.length | 0], + color: colors[Math.floor(Math.random() * colors.length) | 0], rot: Math.random() * 360 + 180, scale: 0.5 + Math.random() * 0.7, speed: 0.8 + Math.random() * 0.6, diff --git a/src/lib/digest-email.ts b/src/lib/digest-email.ts index 717fceee2..a87c5da5b 100644 --- a/src/lib/digest-email.ts +++ b/src/lib/digest-email.ts @@ -398,7 +398,7 @@ export function buildDigestText(data: DigestEmailData): string { if (m.topLanguages.length > 0) { lines.push(`Top languages:`); m.topLanguages.forEach((l) => { - lines.push(` ${l.name.padEnd(14)} ${l.percentage.toFixed(1)}%`); + lines.push(` ${l.name.padEnd(14, " ")} ${l.percentage.toFixed(1)}%`); }); lines.push(``); }