Изменения
Перейти к навигации
Перейти к поиску
Строка 115:
Строка 115:
+
+
Строка 134:
Строка 136:
+
+
+
+
+
+
+
+
+
− if (not datein.month) then datein.month = "" end
− if (not datein.year) then datein.year = "" end
− +
Строка 374:
Строка 383:
− +
поддержка дат до нашей эры
elseif not inbord(nums[1],1,31) then
elseif not inbord(nums[1],1,31) then
dateout = {["year"]=nums[1], ["month"]=nums[2], ["day"]=nums[3]}
dateout = {["year"]=nums[1], ["month"]=nums[2], ["day"]=nums[3]}
elseif inbord(nums[1],1,31) then
dateout = {["year"]=nums[3], ["month"]=nums[2], ["day"]=nums[1]}
else
else
-- local lang = mw.getContentLanguage()
-- local lang = mw.getContentLanguage()
local my_separ = ""
local my_separ = ""
local monlan = ""
local monlan = ""
local era = ""
if (not (not datein.day)) and (not (not datein.month)) then dm_separ = " " end
if (not (not datein.day)) and (not (not datein.month)) then dm_separ = " " end
if (not (not datein.month)) and (not (not datein.year)) then my_separ = " " end
if (not (not datein.month)) and (not (not datein.year)) then my_separ = " " end
if not datein.year then datein.year = ""
elseif datein.year == "" then
elseif datein.year < 1 then
local negyear = datein.year
datein.year = 1 - negyear
era = " д.н.э."
end
if (not datein.month) then datein.month = "" end
if (not datein.day) then datein.day = "" end
if (not datein.day) then datein.day = "" end
if type(my_separ) ~= "string" or type(dm_separ) ~= "string" then error("Separator fail to work") end
if type(my_separ) ~= "string" or type(dm_separ) ~= "string" then error("Separator fail to work") end
if (not datein.month) or (datein.month == "") then
if (not datein.month) or (datein.month == "") then
else monlan = monthlang[datein.month] end
else monlan = monthlang[datein.month] end
local dateout = datein.day .. dm_separ .. monlan .. my_separ .. datein.year
local dateout = datein.day .. dm_separ .. monlan .. my_separ .. datein.year .. era
return dateout
return dateout
end
end
end
end
-- =p.OldDate(mw.getCurrentFrame():newChild{title="smth",args={"20.02.2020"}})
-- =p.OldDate(mw.getCurrentFrame():newChild{title="smth",args={"20.02.2020","ю","днэ"}})
function p.OldDate( frame )
function p.OldDate( frame )