التسجيل فى الموقع كل أحد من 9 إلى 12 مساءً
وحدة:CopticDate
اذهب إلى التنقل
اذهب إلى البحث
يمكن إنشاء صفحة توثيق الوحدة في وحدة:CopticDate/شرح
local p = {}; function p.toCoptic(frame) -- {{#invoke:CopticDate|toCoptic|year|month|day}} local intYear = tonumber(frame.args[1]) local intMonth = tonumber(frame.args[2]) local intDay = tonumber(frame.args[3]) local SeparatorString = frame.args[4] local StringFormat = frame.args[5] local SiniksarFormat = frame.args[6] if intYear == nil then intYear = tonumber(os.date( "%Y" )) end if intMonth == nil then intMonth = tonumber(os.date( "%m" )) end if intDay == nil then intDay = tonumber(os.date( "%d" )) end if SeparatorString == nil or SeparatorString == "" then SeparatorString = " " end local aMonth = math.floor(math.abs((14 - intMonth) / 12)) local jYear = intYear + 4800 - aMonth local jMonth = intMonth + 12 * aMonth - 3 local julianDate = intDay + math.floor(math.abs((153 * jMonth + 2) / 5)) + 365 * jYear + math.floor(math.abs(jYear / 4)) - math.floor(math.abs(jYear / 100)) + math.floor(math.abs(jYear / 400)) - 32045 local julianBase = math.floor(math.abs(julianDate + 0.5)) + 124 local baseYear = (4 * julianBase + 3) / 1461 local baseLeap = ((4 * julianBase + 3) % 1461) / 4 local baseMonth = baseLeap / 30 local baseDay = baseLeap % 30 local finalDay = math.floor(math.abs(baseDay + 1)) local finalMonth = math.floor(math.abs((baseMonth % 13) + 1)) local finalYear = math.floor(math.abs(baseYear - 4996 + (13 - finalMonth) / 13)) local finalMonthString = { "[[توت (شهر)|توت]]", "[[بابة]]", "[[هاتور]]", "[[كيهك]]", "[[طوبة(شهر)|طوبة]]", "[[أمشير]]", "[[برمهات]]", "[[برمودة]]", "[[بشنس]]", "[[بؤونة]]", "[[أبيب]]", "[[مسرى]]", "[[النسيء (شهر قبطى)|النسيء]]" } local finalMonthStringWithoutLink = { "توت", "بابة", "هاتور", "كيهك", "طوبة", "أمشير", "برمهات", "برمودة", "بشنس", "بؤونة", "أبيب", "مسرى", "النسيء" } if StringFormat == nil or StringFormat == "" then if SiniksarFormat == nil or SiniksarFormat == "" then return(finalDay .. SeparatorString .. finalMonth .. SeparatorString .. finalYear) else return(finalDay .. SeparatorString .. finalMonth) end else if SiniksarFormat == nil or SiniksarFormat == "" then return(finalDay .. SeparatorString .. finalMonthString[finalMonth] .. SeparatorString .. finalYear) else return(finalDay .. SeparatorString .. finalMonthStringWithoutLink[finalMonth]) end end end return p