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
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user