Islamic Date Today Pakistan & World :root{ --green:#0b8d4b; --dark:#1f2937; --light:#f4f7f6; --white:#ffffff; --border:#e5e7eb; } *{ margin:0; padding:0; box-sizing:border-box; } body{ font-family:'Poppins',sans-serif; background:var(--light); padding:10px; color:var(--dark); font-size:11px; } .wrapper{ max-width:500px; margin:auto; } /* HERO */ .hero{ background:linear-gradient(135deg,#0b8d4b,#06663b); color:#fff; padding:14px 16px; border-radius:12px; text-align:center; margin-bottom:10px; } .hero h1{ font-size:18px; font-weight:600; margin-bottom:2px; } .live{ font-size:11px; opacity:.92; font-weight:300; } /* BLOCKS */ .block{ background:#fff; border-radius:10px; padding:10px 14px; margin-bottom:8px; box-shadow:0 2px 6px rgba(0,0,0,.04); display:flex; flex-direction:column; gap:2px; } .label{ font-size:10px; text-transform:uppercase; color:#6b7280; font-weight:600; } .value{ font-size:13px; font-weight:600; line-height:1.4; } .green-block{ background:#ecfdf5; border-left:4px solid var(--green); } /* TABLE */ .table-block{ background:#fff; border-radius:10px; overflow:hidden; box-shadow:0 2px 6px rgba(0,0,0,.04); margin-bottom:10px; } .table-head{ background:#111827; color:#fff; padding:8px 12px; font-size:11px; font-weight:600; } .row{ display:flex; justify-content:space-between; align-items:center; padding:10px 12px; border-top:1px solid #edf2f7; font-size:11px; } .row.active{ background:#f0fff4; color:var(--green); font-weight:600; } /* MONTH CARDS */ .month-section{ margin-top:10px; } .month-title{ font-size:12px; font-weight:600; margin-bottom:8px; color:var(--green); } .month-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:6px; } .month-card{ background:#fff; border-radius:8px; padding:8px 12px; box-shadow:0 2px 4px rgba(0,0,0,.02); border:1px solid #edf2f7; display:flex; justify-content:space-between; align-items:center; } .month-number{ font-size:10px; color:#94a3b8; } .month-name{ font-size:11px; font-weight:500; } .month-card.active{ background:var(--green); color:#fff; border-color:var(--green); } .month-card.active .month-number{ color:#d1fae5; font-weight:600; } /* MOBILE */ @media(max-width:400px) { .month-grid { grid-template-columns:1fr; } } Islamic Date Today Gregorian Date World Islamic Date Pakistan Islamic Date Regional Islamic Calendar Global / Saudi Arabia Pakistan Islamic Months const islamicMonths = [ "Muharram", "Safar", "Rabi al-Awwal", "Rabi al-Thani", "Jumada al-Awwal", "Jumada al-Thani", "Rajab", "Sha'ban", "Ramadan", "Shawwal", "Dhu al-Qi'dah", "Dhu al-Hijjah" ]; /* DYNAMIC CALCULATION WITH SYNCHRONIZED REFS: At this time (May 26, 2026), both Pakistan and the global/Saudi calendar are aligned on 9 Dhu al-Hijjah 1447 AH (The Blessed Day of Arafah). */ function getHijriDate(date, dayOffset = 0) { // Base reference anchored to May 26, 2026 = 9 Dhu al-Hijjah 1447 AH const referenceDate = new Date(Date.UTC(2026, 4, 26)); const referenceHijriDay = 9 + dayOffset; const referenceMonth = 11; // Dhu al-Hijjah (0-indexed) const referenceYear = 1447; const oneDay = 1000 * 60 * 60 * 24; let diffDays = Math.floor((date - referenceDate) / oneDay); let day = referenceHijriDay + diffDays; let month = referenceMonth; let year = referenceYear; const monthDays = [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29]; while (day > monthDays[month]) { day -= monthDays[month]; month++; if (month > 11) { month = 0; year++; } } while (day <= 0) { month--; if (month < 0) { month = 11; year--; } day += monthDays[month]; } return { day, month, year, monthName: islamicMonths[month] }; } function updateWidget() { const pakistanNow = new Date(new Date().toLocaleString("en-US", { timeZone: "Asia/Karachi" })); const gregorian = pakistanNow.toLocaleDateString('en-PK', { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric', timeZone: 'Asia/Karachi' }); // Generated through separate calculations if offsets ever split in the future const hijriPakistan = getHijriDate(pakistanNow, 0); const hijriWorld = getHijriDate(pakistanNow, 0); // Kept identical as requested const pakText = `${hijriPakistan.day} ${hijriPakistan.monthName} ${hijriPakistan.year} AH`; const worldText = `${hijriWorld.day} ${hijriWorld.monthName} ${hijriWorld.year} AH`; document.getElementById('gregorianDate').textContent = gregorian; document.getElementById('worldDate').textContent = worldText; document.getElementById('pakistanDate').textContent = pakText; document.getElementById('tableWorld').textContent = worldText; document.getElementById('tablePakistan').textContent = pakText; document.getElementById('liveTime').textContent = pakistanNow.toLocaleTimeString('en-PK', { hour: '2-digit', minute: '2-digit', second: '2-digit', timeZone: 'Asia/Karachi' }) + ' PKT'; // Flat structured grid loop let html = ''; islamicMonths.forEach((month, index) => { const isActive = index === hijriPakistan.month; html += ` <div class="month-card ${isActive ? 'active' : ''}"> <span class="month-name">${month}</span> <span class="month-number">${index + 1}</span> </div> `; }); document.getElementById('monthsContainer').innerHTML = html; } updateWidget(); setInterval(updateWidget, 1000);