diff --git a/src/components/PromoDiscountBadge.tsx b/src/components/PromoDiscountBadge.tsx index 8f4f845..a210fe0 100644 --- a/src/components/PromoDiscountBadge.tsx +++ b/src/components/PromoDiscountBadge.tsx @@ -18,7 +18,14 @@ const ClockIcon = () => ( const formatTimeLeft = (expiresAt: string, t: (key: string) => string): string => { const now = new Date() - const expires = new Date(expiresAt) + // Ensure UTC parsing - if no timezone specified, assume UTC + let expires: Date + if (expiresAt.includes('Z') || expiresAt.includes('+') || expiresAt.includes('-', 10)) { + expires = new Date(expiresAt) + } else { + // No timezone - treat as UTC + expires = new Date(expiresAt + 'Z') + } const diffMs = expires.getTime() - now.getTime() if (diffMs <= 0) return '' diff --git a/src/components/PromoOffersSection.tsx b/src/components/PromoOffersSection.tsx index d125985..d335bac 100644 --- a/src/components/PromoOffersSection.tsx +++ b/src/components/PromoOffersSection.tsx @@ -36,7 +36,14 @@ const ServerIcon = () => ( // Helper functions const formatTimeLeft = (expiresAt: string): string => { const now = new Date() - const expires = new Date(expiresAt) + // Ensure UTC parsing - if no timezone specified, assume UTC + let expires: Date + if (expiresAt.includes('Z') || expiresAt.includes('+') || expiresAt.includes('-', 10)) { + expires = new Date(expiresAt) + } else { + // No timezone - treat as UTC + expires = new Date(expiresAt + 'Z') + } const diffMs = expires.getTime() - now.getTime() if (diffMs <= 0) return 'Истекло'