Jump to content

Module:DafYomi

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ypn^2 (talk | contribs) at 19:36, 24 November 2024. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

function p.today (frame)
	return p.fromDate(os.date("!*t"))
end

function p.date (frame)
	return p.fromDate(frame.args)
end

function p.fromDate (dat)
	dat.hour = 0
	dat.min = 0
	dat.sec = 0
	
	dat = os.time(dat)
	local date0 = os.time({year=2005,month=2,day=28})
	
	local sinceS = os.difftime(dat, date0) + 200
	local sinceD = math.floor(sinceS / 86400)
	
	return sinceD
end

return p