From ef4a2643201e070c3851a5ce31ed74b3a411b3f4 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Thu, 6 Aug 2026 15:36:49 +0530 Subject: [PATCH] fix: resolve 4 bugs in commitpulse --- app/api/reviews/route.ts | 2 +- utils/dateHelpers.ts | 2 +- utils/time.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/reviews/route.ts b/app/api/reviews/route.ts index 51c6f2779..9e5a25983 100644 --- a/app/api/reviews/route.ts +++ b/app/api/reviews/route.ts @@ -29,7 +29,7 @@ export async function GET(req: Request) { const url = new URL(req.url); const status = url.searchParams.get('status') ?? 'pending'; - const page = Math.max(1, parseInt(url.searchParams.get('page') ?? '1', 10)); + const page = Math.max(1, parseInt(url.searchParams.get('page', 10) ?? '1', 10)); const limit = Math.min( MAX_REVIEWS_PER_PAGE, Math.max(1, parseInt(url.searchParams.get('limit') ?? '20', 10)) diff --git a/utils/dateHelpers.ts b/utils/dateHelpers.ts index b1d7a25e4..d598b8d7f 100644 --- a/utils/dateHelpers.ts +++ b/utils/dateHelpers.ts @@ -37,7 +37,7 @@ export function getAuthorLocalHour(isoDate: string): number { if (isoDate.length >= 13) { const hourStr = isoDate.substring(11, 13); const hour = parseInt(hourStr, 10); - if (!isNaN(hour) && hour >= 0 && hour <= 23) { + if (!Number.isNaN(hour) && hour >= 0 && hour <= 23) { return hour; } } diff --git a/utils/time.ts b/utils/time.ts index 8a31fa765..4d42c7a85 100644 --- a/utils/time.ts +++ b/utils/time.ts @@ -53,7 +53,7 @@ export function getSecondsUntilMidnightInTimezone(tz?: string | null): number { hourCycle: 'h23', }).formatToParts(now); - const get = (type: string) => parseInt(parts.find((p) => p.type === type)?.value ?? '0', 10); + const get = (type: string) => parseInt(parts.find((p, 10) => p.type === type)?.value ?? '0', 10); // hour24 can return 24 at midnight in some Intl implementations; normalise with % 24 const hour = get('hour') % 24;