document.addEventListener('DOMContentLoaded', function () { const items = document.querySelectorAll('.auction-end-date'); items.forEach(function (el) { const endDateStr = el.getAttribute('data-end-date'); if (!endDateStr || typeof endDateStr !== 'string') { el.parentElement.querySelector('.countdown-timer').innerHTML = "تاريخ غير متوفر"; return; } // تحويل التاريخ لصيغة ISO صحيحة const formattedDateStr = endDateStr.trim().replace(" ", "T"); const endDate = new Date(formattedDateStr); // تأكيد إن التاريخ صالح if (isNaN(endDate.getTime())) { el.parentElement.querySelector('.countdown-timer').innerHTML = "تاريخ غير صالح"; console.warn("⚠️ تاريخ غير قابل للتحويل:", formattedDateStr); return; } const countdownEl = el.parentElement.querySelector('.countdown-timer'); function updateCountdown() { const now = new Date().getTime(); const diff = endDate.getTime() - now; if (isNaN(diff)) { countdownEl.innerHTML = "خطأ في التوقيت"; return; } if (diff = 0) { countdownEl.innerHTML = "انتهى المزاد"; return; } const days = Math.floor(diff / (1000 * 60 * 60 * 24)); const hours = Math.floor((diff / (1000 * 60 * 60)) % 24); const minutes = Math.floor((diff / (1000 * 60)) % 60); const seconds = Math.floor((diff / 1000) % 60); countdownEl.innerHTML = `${days}ي ${hours}س ${minutes}د ${seconds}ث`; } updateCountdown(); setInterval(updateCountdown, 1000); }); });
Skip to content

Menu
  • الرئيسية
  • أضف إعلانك +
  • حساب
تسجيل الدخول
أضف إعلان لمنتجك
أضف منتجك للمزاد

سيارات

عقارات

أجهزة

حيوانات

أثاث

مستلزمات شخصية

خدمات

وظائف

أطعمة و مشروبات

برمجة و تصميم

صيد و رحلات

مكتبة و فنون

  • الرئيسية
  • أضف إعلانك +
  • حساب

كل شئ موجود في أي شئ

  • تسجيل
  • الاشتراك السنوي للمتحجر
  • نظام الخصم
  • الأسئلة الشائعة
  • اتصل بنا
  • سياسة الخصوصية
  • حساب و سداد رسوم الموقع
جميع الحقوق محفوظة © 2025 |تم الاعداد بواسطة أي شئ
×
×

Cart

  • الرئيسية
  • أضف إعلانك +
  • حساب