From eb7cb2d94fc80d2610e9ec78096ae71f024662b5 Mon Sep 17 00:00:00 2001 From: DaX Date: Fri, 11 Jul 2025 12:27:17 +0200 Subject: [PATCH] Add debug logging to investigate countdown timing issue - Added console logs to check sale end date parsing - Debug timezone handling and date calculations - Check browser console for timing info --- 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 753d5b2..515229f 100644 --- a/src/components/SaleCountdown.tsx +++ b/src/components/SaleCountdown.tsx @@ -31,8 +31,11 @@ export function SaleCountdown({ hasActiveSale, maxSalePercentage = 5, saleEndDat let targetDate: Date; if (saleEndDate) { - // Use the sale end date from admin + // Use the sale end date from admin - ensure proper timezone handling targetDate = new Date(saleEndDate); + console.log('Sale end date from DB:', saleEndDate); + console.log('Parsed target date:', targetDate); + console.log('Current time:', now); } else { // Fallback to next Sunday at 23:59:59 const nextSunday = new Date(); @@ -45,6 +48,8 @@ export function SaleCountdown({ hasActiveSale, maxSalePercentage = 5, saleEndDat } const difference = targetDate.getTime() - now.getTime(); + console.log('Time difference (ms):', difference); + console.log('Days:', Math.floor(difference / (1000 * 60 * 60 * 24))); if (difference > 0) { return {