Module:Sandbox/BrandonXLF/1

This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 03:02, 22 June 2022. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local mDate = require('Module:Date')
local Date = mDate._Date
local p = {}
	
function p.main()
	local currentDate = Date('currentdate')
	local date = Date('1 December 2010')
	local out = ''
	local currentMonth
	local currentYear
	
	while date ~= currentDate do
		if date.year ~= currentYear then
			out = out .. '==' .. date.year .. '=='
			currentYear = date.year
		end
		
		if date.month ~= currentMonth then
			out = out .. '===' .. date.month .. '==='
			currentMonth = date.month
		end
		
		out = out .. '[[Wikipedia:Main Page history/' .. date:text('%Y %B %-d') .. '|' .. date:text('%-d') .. ']]' .. '[[Wikipedia:Main Page history/' .. date:text('%Y %B %-d') .. 'b|b]]'
		
		date = date + 1
	end
	
	return out
end

return p