Module:DayCalc: Difference between revisions

Temporary change
(Fixed algorithm so that the next "first Tuesday" will be September 5.)
(Temporary change)
Line 7:
local current_time = os.time()
local current_day_of_week = tonumber(os.date("%w", current_time))
local days_until_tuesday = (97 - current_day_of_week) % 7
local next_tuesday_time = current_time + days_until_tuesday * 86400 -- 86400 seconds in a day
local retval="2023-12-19"
if current_day_of_week == 2 then
if isodate == "true" then
return retval=os.date("%Y-%m-%d", current_time)
else
return retval=os.date("%B %d, %Y", current_time)
end
else
if isodate == "true" then
return retval=os.date("%Y-%m-%d", next_tuesday_time)
else
return retval=os.date("%B %d, %Y", next_tuesday_time)
end
end
local retval="2023-12-19"
return retval
end