יחידה:תאריך עברי: הבדלים בין גרסאות בדף

אין תקציר עריכה
אין תקציר עריכה
שורה 271: שורה 271:


function verify(f)
function verify(f)
frame = f
if f.args[1] == ""
then return "" end
which = false
which = false
local ans = ""
return fromhebrewandverify(f)
if f.args[2] ~= ""
then ans = tohebrew0(f.args[2]) end
if f.args[1] ~= ""
then ans = ans .. fromhebrewandverify(f) end
return ans
end
end


שורה 299: שורה 295:
then ans = ans .. "-" .. tohebrewnum("01-12-" .. gyear, fromyear)
then ans = ans .. "-" .. tohebrewnum("01-12-" .. gyear, fromyear)
end
end
return ifwhich(ans)
return ans
end
end


שורה 315: שורה 311:
local year2 = fromyear(date2)
local year2 = fromyear(date2)
if year1 ~= year2
if year1 ~= year2
then return ifwhich(month1 .. " " .. year1 .. " - " .. month2 .. " " .. year2)
then return month1 .. " " .. year1 .. " - " .. month2 .. " " .. year2
elseif month1 ~= month2
elseif month1 ~= month2
then return ifwhich(month1 .. "-" .. month2 .. " " .. year1)
then return month1 .. "-" .. month2 .. " " .. year1
else return ifwhich(month1 .. " " .. year1) end
else return month1 .. " " .. year1 end
end
end


שורה 327: שורה 323:
checkcasp(take)
checkcasp(take)
take = same(take .. " + " .. diff(take) .. " days")
take = same(take .. " + " .. diff(take) .. " days")
return ifwhich(format(take))
return format(take)
end
end


function tohebrewnum(wdate, format)
function tohebrewnum(wdate, format)
if find1(wdate, "-", 3) == 3 and find1(wdate, "-", 6) == 6 and len1(wdate) == 9
then wdate = sub1(wdate, 1, 6) .. "0" .. sub1(wdate, 7, 9) end
if same(wdate) ~= wdate
if same(wdate) ~= wdate
then error("wrong date") end
then error("wrong date") end
checkcasp(wdate)
checkcasp(wdate)
wdate = same(wdate .. " + " .. diff(wdate) .. " days")
wdate = same(wdate .. " + " .. diff(wdate) .. " days")
return ifwhich(format(wdate))
return format(wdate)
end
end


שורה 406: שורה 400:
end
end


function tohebrew0(wdate)
function tohebrew(f)
local success, res = pcall(tohebrew1, wdate)
frame = f
local success, res = pcall(tohebrew1, frame.args[1])
if success
if success
then return res
then return res
elseif frame.args["about"] == "כן" and
elseif frame.args["about"] == "כן" and
frame:expandTemplate({title = "גיל לערכי אישים/מקורב", args = {str = wdate}}) ~= ""
frame:expandTemplate({title = "גיל לערכי אישים/מקורב", args = {str = frame.args[1]}}) ~= ""
then return ifwhich(wdate)
then return frame.args[1]
elseif frame.args["error"] == nil
elseif frame.args["error"] == nil
then return aserror(res) end
then return aserror(res) end
return fixerror(frame.args["error"])
return fixerror(frame.args["error"])
end
function tohebrew(f)
frame = f
which = true
return tohebrew0(frame.args[1])
end
end