<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://twentyonewiki.info/index.php?action=history&amp;feed=atom&amp;title=Module%3ACountdown</id>
	<title>Module:Countdown - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://twentyonewiki.info/index.php?action=history&amp;feed=atom&amp;title=Module%3ACountdown"/>
	<link rel="alternate" type="text/html" href="https://twentyonewiki.info/index.php?title=Module:Countdown&amp;action=history"/>
	<updated>2026-04-12T08:28:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://twentyonewiki.info/index.php?title=Module:Countdown&amp;diff=6423&amp;oldid=prev</id>
		<title>Buburka Rinderbuy: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://twentyonewiki.info/index.php?title=Module:Countdown&amp;diff=6423&amp;oldid=prev"/>
		<updated>2024-05-09T02:32:28Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:32, 8 May 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Buburka Rinderbuy</name></author>
	</entry>
	<entry>
		<id>https://twentyonewiki.info/index.php?title=Module:Countdown&amp;diff=6422&amp;oldid=prev</id>
		<title>Template:Countdown&gt;Jackmcbarn: if os.time fails, the error is exceptionally unhelpful. give a helpful one instead. from sandbox</title>
		<link rel="alternate" type="text/html" href="https://twentyonewiki.info/index.php?title=Module:Countdown&amp;diff=6422&amp;oldid=prev"/>
		<updated>2020-08-02T05:54:21Z</updated>

		<summary type="html">&lt;p&gt;if os.time fails, the error is exceptionally unhelpful. give a helpful one instead. from sandbox&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module powers {{countdown}}.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Constants&lt;br /&gt;
local lang = mw.language.getContentLanguage()&lt;br /&gt;
local getArgs = require('Module:Arguments').getArgs&lt;br /&gt;
&lt;br /&gt;
local function formatMessage(secondsLeft, event, color)&lt;br /&gt;
	local timeLeft = lang:formatDuration(secondsLeft, {'years', 'weeks', 'days', 'hours', 'minutes', 'seconds'})&lt;br /&gt;
	-- Find whether we are plural or not.&lt;br /&gt;
	local isOrAre&lt;br /&gt;
	if string.match(timeLeft, '^%d+') == '1' then&lt;br /&gt;
		isOrAre = 'is'&lt;br /&gt;
	else&lt;br /&gt;
		isOrAre = 'are'&lt;br /&gt;
	end&lt;br /&gt;
	-- Color and bold the numbers, because it makes them look important.&lt;br /&gt;
	timeLeft = string.gsub(timeLeft, '(%d+)', '&amp;lt;span style=&amp;quot;color: ' .. (color or '#F00') .. '; font-weight: bold;&amp;quot;&amp;gt;%1&amp;lt;/span&amp;gt;')&lt;br /&gt;
	return string.format('There %s %s until %s.', isOrAre, timeLeft, event)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
&lt;br /&gt;
	if not (args.year and args.month and args.day) then&lt;br /&gt;
		return '&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: year, month, and day must be specified&amp;lt;/strong&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local timeArgs = {year=args.year, month=args.month, day=args.day, hour=args.hour, min=args.minute, sec=args.second}&lt;br /&gt;
	for k,v in pairs(timeArgs) do&lt;br /&gt;
		if not tonumber(v) then&lt;br /&gt;
			error('Argument ' .. k .. ' could not be parsed as a number: ' .. v)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local eventTime = os.time(timeArgs)&lt;br /&gt;
	local timeToStart = os.difftime(eventTime, os.time()) -- (future time - current time)&lt;br /&gt;
	local text&lt;br /&gt;
	if timeToStart &amp;gt; 0 then&lt;br /&gt;
		-- Event has not begun yet&lt;br /&gt;
		text = formatMessage(timeToStart, args.event or 'the event begins', args.color)&lt;br /&gt;
	elseif args.duration then&lt;br /&gt;
		local timeToEnd&lt;br /&gt;
		if args['duration unit'] then&lt;br /&gt;
			-- Duration is in unit other than seconds, use formatDate to add&lt;br /&gt;
			timeToEnd = tonumber(lang:formatDate('U', '@' .. tostring(timeToStart) .. ' +' .. tostring(args.duration) .. ' ' .. args['duration unit']))&lt;br /&gt;
		else&lt;br /&gt;
			timeToEnd = timeToStart + (tonumber(args.duration) or error('args.duration should be a number of seconds', 0))&lt;br /&gt;
		end&lt;br /&gt;
		if timeToEnd &amp;gt; 0 then&lt;br /&gt;
			-- Event is in progress&lt;br /&gt;
			text = args.eventstart or formatMessage(timeToEnd, (args.event or 'the event') .. ' ends', args.color)&lt;br /&gt;
		else&lt;br /&gt;
			-- Event had a duration and has now ended&lt;br /&gt;
			text = args.eventend or ((lang:ucfirst(args.event or 'The event')) .. ' has ended.')&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- Event had no duration and has begun&lt;br /&gt;
		text = args.eventstart or ((lang:ucfirst(args.event or 'The event')) .. ' has started.')&lt;br /&gt;
	end&lt;br /&gt;
	local refreshLink&lt;br /&gt;
	if args.refresh == 'no' then&lt;br /&gt;
		refreshLink = ''&lt;br /&gt;
	else&lt;br /&gt;
		refreshLink = mw.title.getCurrentTitle():fullUrl({action = 'purge'})&lt;br /&gt;
		refreshLink = string.format(' &amp;lt;small&amp;gt;&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;([%s refresh])&amp;lt;/span&amp;gt;&amp;lt;/small&amp;gt;', refreshLink)&lt;br /&gt;
	end&lt;br /&gt;
	return text .. refreshLink&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Template:Countdown&gt;Jackmcbarn</name></author>
	</entry>
</feed>