<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.xmethod.net/index.php?action=history&amp;feed=atom&amp;title=Module%3ABirth_based_on_age_as_of_dates</id>
	<title>Module:Birth based on age as of dates - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.xmethod.net/index.php?action=history&amp;feed=atom&amp;title=Module%3ABirth_based_on_age_as_of_dates"/>
	<link rel="alternate" type="text/html" href="https://wiki.xmethod.net/index.php?title=Module:Birth_based_on_age_as_of_dates&amp;action=history"/>
	<updated>2026-05-01T22:26:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.4</generator>
	<entry>
		<id>https://wiki.xmethod.net/index.php?title=Module:Birth_based_on_age_as_of_dates&amp;diff=2319&amp;oldid=prev</id>
		<title>Docmoates: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.xmethod.net/index.php?title=Module:Birth_based_on_age_as_of_dates&amp;diff=2319&amp;oldid=prev"/>
		<updated>2026-01-01T14:19:26Z</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;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:19, 1 January 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&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;!-- diff cache key mediawiki:diff:1.41:old-2318:rev-2319 --&gt;
&lt;/table&gt;</summary>
		<author><name>Docmoates</name></author>
	</entry>
	<entry>
		<id>https://wiki.xmethod.net/index.php?title=Module:Birth_based_on_age_as_of_dates&amp;diff=2318&amp;oldid=prev</id>
		<title>wiki&gt;MusikBot II: Protected &quot;Module:Birth based on age as of dates&quot;: High-risk template or module: 6946 transclusions (more info) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://wiki.xmethod.net/index.php?title=Module:Birth_based_on_age_as_of_dates&amp;diff=2318&amp;oldid=prev"/>
		<updated>2025-12-23T18:00:32Z</updated>

		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/Module:Birth_based_on_age_as_of_dates&quot; title=&quot;Module:Birth based on age as of dates&quot;&gt;Module:Birth based on age as of dates&lt;/a&gt;&amp;quot;: &lt;a href=&quot;https://en.wikipedia.org/wiki/High-risk_templates&quot; class=&quot;extiw&quot; title=&quot;wikipedia:High-risk templates&quot;&gt;High-risk template or module&lt;/a&gt;: 6946 transclusions (&lt;a href=&quot;/index.php?title=User:MusikBot_II/TemplateProtector&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:MusikBot II/TemplateProtector (page does not exist)&quot;&gt;more info&lt;/a&gt;) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {} --p stands for package&lt;br /&gt;
&lt;br /&gt;
local getArgs = require(&amp;#039;Module:Arguments&amp;#039;).getArgs&lt;br /&gt;
&lt;br /&gt;
local function month_number(text)&lt;br /&gt;
	month_numbers = {&lt;br /&gt;
		jan = 1, january = 1,&lt;br /&gt;
		feb = 2, february = 2,&lt;br /&gt;
		mar = 3, march = 3,&lt;br /&gt;
		apr = 4, april = 4,&lt;br /&gt;
		may = 5,&lt;br /&gt;
		jun = 6, june = 6,&lt;br /&gt;
		jul = 7, july = 7,&lt;br /&gt;
		aug = 8, august = 8,&lt;br /&gt;
		sep = 9, september = 9, sept = 9,&lt;br /&gt;
		oct = 10, october = 10,&lt;br /&gt;
		nov = 11, november = 11,&lt;br /&gt;
		dec = 12, december = 12,&lt;br /&gt;
	}&lt;br /&gt;
	return tonumber(text) or month_numbers[text:lower():gsub(&amp;#039;%.&amp;#039;, &amp;#039;&amp;#039;)]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main( frame )&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
	return p.date(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.date( args )&lt;br /&gt;
	if args[4] then&lt;br /&gt;
		args[3] = month_number(args[3])&lt;br /&gt;
		date_latest = os.time({year = args[2] - args[1], month = args[3], day = args[4]}) --we compute the latest possible birthdate based on the first give data point&lt;br /&gt;
		date_earliest = os.time({year = args[2] - args[1] - 1, month = args[3], day = args[4] + 1})&lt;br /&gt;
	elseif args[3] then&lt;br /&gt;
		args[3] = month_number(args[3])&lt;br /&gt;
		date_latest = os.time({year = args[2] - args[1], month = args[3] + 1, day = 0}) --gets the last day of the month&lt;br /&gt;
		date_earliest = os.time({year = args[2] - args[1] - 1, month = args[3], day = 2})&lt;br /&gt;
	else&lt;br /&gt;
		date_latest = os.time({year = args[2] - args[1], month = 12, day = 31})&lt;br /&gt;
		date_earliest = os.time({year = args[2] - args[1] - 1, month = 1, day = 2})&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	--then we loop on other given datapoints to triangulate the date&lt;br /&gt;
	frame_arg = 5&lt;br /&gt;
	while args[frame_arg + 3] ~= nil do&lt;br /&gt;
		args[frame_arg + 2] = month_number(args[frame_arg + 2])&lt;br /&gt;
		date_latest_new = os.time({year = args[frame_arg + 1] - args[frame_arg], month = args[frame_arg + 2], day = args[frame_arg + 3]})&lt;br /&gt;
		date_latest = math.min(date_latest, date_latest_new)&lt;br /&gt;
		date_earliest_new = os.time({year = args[frame_arg + 1] - args[frame_arg] - 1, month = args[frame_arg + 2], day = args[frame_arg + 3]}) + 86402&lt;br /&gt;
		date_earliest = math.max(date_earliest, date_earliest_new)&lt;br /&gt;
		frame_arg = frame_arg + 4&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	--we check if the calculated birth year is the same&lt;br /&gt;
	if os.date(&amp;quot;%Y&amp;quot;, date_earliest) == os.date(&amp;quot;%Y&amp;quot;, date_latest) then&lt;br /&gt;
		birth_year_string = os.date(&amp;quot;%Y&amp;quot;, date_earliest)&lt;br /&gt;
	elseif yesno(args[&amp;quot;slash&amp;quot;] or false) then&lt;br /&gt;
		birth_year_string = os.date(&amp;quot;%Y&amp;quot;, date_earliest) .. &amp;quot;/&amp;quot; .. os.date(&amp;quot;%Y&amp;quot;, date_latest)&lt;br /&gt;
	else&lt;br /&gt;
		birth_year_string = os.date(&amp;quot;%Y&amp;quot;, date_earliest) .. &amp;quot; or &amp;quot; .. os.date(&amp;quot;%Y&amp;quot;, date_latest)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	--then we convert back to a time table to see if the person is past their birthday&lt;br /&gt;
	birthday_earliest = {year = os.date(&amp;quot;%Y&amp;quot;, os.time()), month = os.date(&amp;quot;%m&amp;quot;, date_earliest), day = os.date(&amp;quot;%d&amp;quot;, date_earliest)}&lt;br /&gt;
	birthday_latest = {year = os.date(&amp;quot;%Y&amp;quot;, os.time()), month = os.date(&amp;quot;%m&amp;quot;, date_latest), day = os.date(&amp;quot;%d&amp;quot;, date_latest)}&lt;br /&gt;
	&lt;br /&gt;
	if yesno(args.noage or false) then&lt;br /&gt;
		full_string = birth_year_string&lt;br /&gt;
	else&lt;br /&gt;
		if os.date(&amp;quot;%Y&amp;quot;, date_earliest) == os.date(&amp;quot;%Y&amp;quot;, date_latest) then&lt;br /&gt;
			year_diff = os.date(&amp;quot;%Y&amp;quot;, os.time()) - os.date(&amp;quot;%Y&amp;quot;, date_latest)&lt;br /&gt;
			if os.time() &amp;lt; os.time(birthday_earliest) then&lt;br /&gt;
				full_string = birth_year_string .. &amp;quot; (age&amp;amp;nbsp;&amp;quot; .. year_diff-1 .. &amp;quot;)&amp;quot;&lt;br /&gt;
			elseif os.time() &amp;lt; os.time(birthday_latest) then&lt;br /&gt;
				full_string = birth_year_string .. &amp;quot; (age&amp;amp;nbsp;&amp;quot; .. year_diff-1 .. &amp;quot;–&amp;quot; .. year_diff .. &amp;quot;)&amp;quot;&lt;br /&gt;
			else&lt;br /&gt;
				full_string = birth_year_string .. &amp;quot; (age&amp;amp;nbsp;&amp;quot; .. year_diff .. &amp;quot;)&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			year_diff = os.date(&amp;quot;%Y&amp;quot;, os.time()) - os.date(&amp;quot;%Y&amp;quot;, date_latest)&lt;br /&gt;
			if os.time() &amp;lt; os.time(birthday_latest) then&lt;br /&gt;
				full_string = birth_year_string .. &amp;quot; (age&amp;amp;nbsp;&amp;quot; .. year_diff-1 .. &amp;quot;–&amp;quot; .. year_diff .. &amp;quot;)&amp;quot;&lt;br /&gt;
			elseif os.time() &amp;lt; os.time(birthday_earliest) then&lt;br /&gt;
				full_string = birth_year_string .. &amp;quot; (age&amp;amp;nbsp;&amp;quot; .. year_diff .. &amp;quot;)&amp;quot;&lt;br /&gt;
			else&lt;br /&gt;
				full_string = birth_year_string .. &amp;quot; (age&amp;amp;nbsp;&amp;quot; .. year_diff .. &amp;quot;–&amp;quot; .. year_diff+1 .. &amp;quot;)&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
    return full_string&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>wiki&gt;MusikBot II</name></author>
	</entry>
</feed>