Content deleted Content added
No edit summary |
No edit summary |
||
Line 174:
]]
function renderHoli(
local hits = 0
Line 182:
-- user-supplied date calculator
if
if
startdate =
enddate = dateOffset(startdate,
else
return inlineError("holiday", 'Invalid calculator result', tname )
Line 191:
-- read dates from localfile -- it assumes dates in the json are in chrono order, needs a more flexible method
elseif
local numRecords = tableLength(
for i = 1, numRecords do
if mw.ustring.find(
if hits == 0 then
startdate =
hits = 1
end
if hits >= tonumber(
enddate =
break
end
Line 210:
-- Verify data is OK
if startdate == nil or enddate == nil then
if
enddate = dateOffset(startdate, 8)
else
Line 218:
-- Generate start-date offset (ie. holiday starts the evening before the given date)
if
startdate = dateOffset(startdate,
if startdate ~= enddate then
enddate = dateOffset(enddate,
else
end
end
-- Generate end-date outside-Irael offset (ie. outside Israel the holiday ends +1 day later)
endoutoffset =
-- Format dates into df format
Line 250:
-- return output
if startdate == enddate or
return
else
return
end
end
--[[--------------------------< calendardate >-----------------------
Line 340 ⟶ 318:
if cfg[holiday].datatype == "localfile" then
eventfile = mw.loadData ('Module:Calendar date/localfiles/' .. holiday)
if eventfile.event
eventdata = eventfile.event
--local year, month, day = eventdata.date:match ('(%d%d%d%d)-(%d%d)-(%d%d)')
--if not isValidDate(year, month, day) then
-- return inlineError("holiday", '{{Calendar date}} – invalid date ' .. calcdate, tname) .. createTracking()
--end
else
return inlineError("holiday", '{{Calendar date}} – unknown holiday file Module:Calendar date/localfiles/' .. holiday .. '</span>', tname) .. createTracking()
|