From 04b7ab9b55da57c1f9bc37da7753764afef02b50 Mon Sep 17 00:00:00 2001 From: DaX Date: Fri, 11 Jul 2025 12:37:35 +0200 Subject: [PATCH] Fix countdown to show full days by setting end time to end of day - Always set sale end time to 23:59:59 of target date - Ensures proper day counting regardless of time selected in admin - July 11 to July 18 should now show 7 days instead of 2 --- src/components/SaleCountdown.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/SaleCountdown.tsx b/src/components/SaleCountdown.tsx index 515229f..9b52b8d 100644 --- a/src/components/SaleCountdown.tsx +++ b/src/components/SaleCountdown.tsx @@ -31,8 +31,13 @@ export function SaleCountdown({ hasActiveSale, maxSalePercentage = 5, saleEndDat let targetDate: Date; if (saleEndDate) { - // Use the sale end date from admin - ensure proper timezone handling + // Use the sale end date from admin targetDate = new Date(saleEndDate); + + // Always set to end of day for proper countdown display + const saleDate = new Date(saleEndDate); + targetDate = new Date(saleDate.getFullYear(), saleDate.getMonth(), saleDate.getDate(), 23, 59, 59, 999); + console.log('Sale end date from DB:', saleEndDate); console.log('Parsed target date:', targetDate); console.log('Current time:', now);