setInterval(omr, 100); omr(); function getHijriDate(date) { const formatter = new Intl.DateTimeFormat( "en-u-ca-islamic-umalqura", { year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" } ); const parts = formatter.formatToParts(date); const result = {}; parts.forEach(function(part) { if (part.type !== "literal") { result[part.type] = parseInt(part.value, 10); } }); return result; } function calculateHijri(startYear, startMonth, startDay) { const now = new Date(); const hijri = getHijriDate(now); let year = hijri.year - startYear; let month = hijri.month - startMonth; let day = hijri.day - startDay; let hour = now.getHours(); let minute = now.getMinutes(); let second = now.getSeconds(); if (day < 0) { day += 30; month--; } if (month < 0) { month += 12; year--; } return { year: year, month: month, day: day, hour: hour, minute: minute, second: second }; } function twoDigits(number) { return String(number).padStart(2, "0"); } function omr() { /* * غیبت صغری * آغاز: سال 260 هجری قمری * * مبنا: * 260 / 3 / 1 */ const soghra = calculateHijri( 260, 3, 1 ); /* * غیبت کبری * آغاز: سال 329 هجری قمری * * مبنا: * 329 / 10 / 1 */ const kobra = calculateHijri( 329, 10, 1 ); document.getElementById("ARK-absence-code").innerHTML = `