<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ADate_period</id>
	<title>Module:Date period - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ADate_period"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Date_period&amp;action=history"/>
	<updated>2026-06-06T23:39:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Date_period&amp;diff=135948&amp;oldid=prev</id>
		<title>imported&gt;Chlod at 20:35, 26 August 2021</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Date_period&amp;diff=135948&amp;oldid=prev"/>
		<updated>2021-08-26T20:35:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local Date = require(&amp;#039;Module:Date&amp;#039;)._Date&lt;br /&gt;
local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	return p._main(frame.args[1], frame.args[2], frame.args[&amp;#039;force-year&amp;#039;])&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(_dateA, _dateB, _forceYear)&lt;br /&gt;
	if _dateA == nil and _dateB == nil then&lt;br /&gt;
		error(&amp;#039;Date A or B not provided.&amp;#039;)&lt;br /&gt;
	elseif _dateA == nil then&lt;br /&gt;
		return Date(_dateA):text(&amp;#039;%B %-d&amp;#039;)&lt;br /&gt;
	elseif _dateB == nil then&lt;br /&gt;
		return Date(_dateB):text(&amp;#039;%B %-d&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local dateA = Date(_dateA)&lt;br /&gt;
	local dateB = Date(_dateB)&lt;br /&gt;
	&lt;br /&gt;
	if dateA == nil and dateB == nil then&lt;br /&gt;
		error(&amp;quot;Either date A, date B, or both dates must be valid.&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local forceYear = yesno(_forceYear)&lt;br /&gt;
	&lt;br /&gt;
	-- Handle cases where one of the dates is not a valid date.&lt;br /&gt;
	if dateA == nil and dateB ~= nil then&lt;br /&gt;
		return _dateA .. &amp;#039; – &amp;#039; .. dateB:text(&amp;#039;%B %-d&amp;#039;) .. (forceYear and (&amp;#039;, &amp;#039; .. dateB.year) or &amp;#039;&amp;#039;)&lt;br /&gt;
	elseif dateB == nil and dateA ~= nil then&lt;br /&gt;
		return dateA:text(&amp;#039;%B %-d&amp;#039;) .. (forceYear and (&amp;#039;, &amp;#039; .. dateA.year) or &amp;#039;&amp;#039;) .. &amp;#039; – &amp;#039; .. _dateB&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if dateA.year == dateB.year then&lt;br /&gt;
		if dateA.month == dateB.month and dateA.day == dateB.day then&lt;br /&gt;
			return dateA:text(&amp;#039;%B %-d&amp;#039;)&lt;br /&gt;
		elseif dateA.month == dateB.month then&lt;br /&gt;
			return dateA:text(&amp;#039;%B %-d&amp;#039;) .. &amp;#039; – &amp;#039; .. dateB.day .. (forceYear and (&amp;#039;, &amp;#039; .. dateA.year) or &amp;#039;&amp;#039;)&lt;br /&gt;
		else&lt;br /&gt;
			return dateA:text(&amp;#039;%B %-d&amp;#039;) .. &amp;#039; – &amp;#039; .. dateB:text(&amp;#039;%B %-d&amp;#039;) .. (forceYear and (&amp;#039;, &amp;#039; .. dateA.year) or &amp;#039;&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- Hide year if forced&lt;br /&gt;
		if forceYear == false then&lt;br /&gt;
			return dateA:text(&amp;#039;%B %-d&amp;#039;) .. &amp;#039; – &amp;#039; .. dateB:text(&amp;#039;%B %-d&amp;#039;)&lt;br /&gt;
		else&lt;br /&gt;
			return dateA:text(&amp;#039;%B %-d, %-Y&amp;#039;) .. &amp;#039; – &amp;#039; .. dateB:text(&amp;#039;%B %-d, %-Y&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Chlod</name></author>
	</entry>
</feed>