From 795e2bae35a20f59cd0494510c051d9cdd08d95b Mon Sep 17 00:00:00 2001 From: Tudor Sitaru Date: Thu, 16 Apr 2026 12:28:31 +0100 Subject: [PATCH] =?UTF-8?q?fix(ui):=20countdown=20shows=20Today=20correctl?= =?UTF-8?q?y=20=E2=80=94=20use=20<=20not=20<=3D=20in=20daysUntil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit <= caused today's date to roll forward to next year (returning 365). Co-Authored-By: Claude Sonnet 4.6 --- nextjs-app/components/AdmissionsView.tsx | 2 +- nextjs-app/components/HomeView.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nextjs-app/components/AdmissionsView.tsx b/nextjs-app/components/AdmissionsView.tsx index db5a500..a63ce86 100644 --- a/nextjs-app/components/AdmissionsView.tsx +++ b/nextjs-app/components/AdmissionsView.tsx @@ -10,7 +10,7 @@ function daysUntil(month: number, day: number): number { today.setHours(0, 0, 0, 0); const y = today.getFullYear(); let target = new Date(y, month - 1, day); - if (target <= today) target = new Date(y + 1, month - 1, day); + if (target < today) target = new Date(y + 1, month - 1, day); return Math.round((target.getTime() - today.getTime()) / 86_400_000); } diff --git a/nextjs-app/components/HomeView.tsx b/nextjs-app/components/HomeView.tsx index 5b9643a..61bc079 100644 --- a/nextjs-app/components/HomeView.tsx +++ b/nextjs-app/components/HomeView.tsx @@ -29,7 +29,7 @@ function daysUntil(month: number, day: number): number { today.setHours(0, 0, 0, 0); const y = today.getFullYear(); let target = new Date(y, month - 1, day); - if (target <= today) target = new Date(y + 1, month - 1, day); + if (target < today) target = new Date(y + 1, month - 1, day); return Math.round((target.getTime() - today.getTime()) / 86_400_000); } @@ -38,7 +38,7 @@ function formatCountdownDate(month: number, day: number): string { today.setHours(0, 0, 0, 0); const y = today.getFullYear(); let target = new Date(y, month - 1, day); - if (target <= today) target = new Date(y + 1, month - 1, day); + if (target < today) target = new Date(y + 1, month - 1, day); return target.toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'long', year: 'numeric' }); }