<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://chaldeanwiki.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ADate</id>
		<title>Module:Date - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://chaldeanwiki.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ADate"/>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Date&amp;action=history"/>
		<updated>2026-05-01T00:47:22Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.0</generator>

	<entry>
		<id>https://chaldeanwiki.com/index.php?title=Module:Date&amp;diff=2136&amp;oldid=prev</id>
		<title>Ian: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Date&amp;diff=2136&amp;oldid=prev"/>
				<updated>2015-05-09T10:18:41Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 10:18, 9 May 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&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>Ian</name></author>	</entry>

	<entry>
		<id>https://chaldeanwiki.com/index.php?title=Module:Date&amp;diff=2135&amp;oldid=prev</id>
		<title>Zebulon84: inscriptionDate : bug &quot;Jour invalide&quot;</title>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Date&amp;diff=2135&amp;oldid=prev"/>
				<updated>2015-04-29T03:13:08Z</updated>
		
		<summary type="html">&lt;p&gt;inscriptionDate : bug &amp;quot;Jour invalide&amp;quot;&lt;/p&gt;
&lt;a href=&quot;https://chaldeanwiki.com/index.php?title=Module:Date&amp;amp;diff=2135&amp;amp;oldid=132&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Zebulon84</name></author>	</entry>

	<entry>
		<id>https://chaldeanwiki.com/index.php?title=Module:Date&amp;diff=132&amp;oldid=prev</id>
		<title>Ian: 1 revision imported: Template:Information importing</title>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Date&amp;diff=132&amp;oldid=prev"/>
				<updated>2015-03-30T21:05:00Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported: Template:Information importing&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 21:05, 30 March 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&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>Ian</name></author>	</entry>

	<entry>
		<id>https://chaldeanwiki.com/index.php?title=Module:Date&amp;diff=131&amp;oldid=prev</id>
		<title>Jarekt: set defaults in the _Date function</title>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Date&amp;diff=131&amp;oldid=prev"/>
				<updated>2015-01-19T04:45:44Z</updated>
		
		<summary type="html">&lt;p&gt;set defaults in the _Date function&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[  &lt;br /&gt;
 &lt;br /&gt;
This module is intended for processing of date strings.&lt;br /&gt;
&lt;br /&gt;
Please do not modify this code without applying the changes first at Module:Date/sandbox and testing &lt;br /&gt;
at Module:Date/sandbox/testcases and Module talk:Date/sandbox/testcases.&lt;br /&gt;
&lt;br /&gt;
Authors and maintainers:&lt;br /&gt;
* User:Parent5446 - original version of the function mimicking template:ISOdate&lt;br /&gt;
* User:Jarekt - original version of the functions mimicking template:Date and template:ISOyear&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- =======================================&lt;br /&gt;
-- === Dependencies ======================&lt;br /&gt;
-- =======================================&lt;br /&gt;
local i18n     = require('Module:I18n/date')		-- get localized translations of date formats&lt;br /&gt;
local Fallback = require('Module:Fallback')			-- get fallback functions&lt;br /&gt;
local yesno    = require('Module:Yesno')&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Date&lt;br /&gt;
 &lt;br /&gt;
This function is the core part of the ISOdate template. &lt;br /&gt;
 &lt;br /&gt;
Usage:&lt;br /&gt;
{#invoke:Date|Date|year=|month=|day=|hour=|minute=|second=|lang=en}}&lt;br /&gt;
 &lt;br /&gt;
Parameters:&lt;br /&gt;
     year,month,day,hour,minute,second: broken down date-time component strings&lt;br /&gt;
  lang: The language to display it in&lt;br /&gt;
  case: Language format (genitive, etc.) for some languages&lt;br /&gt;
 class: CSS class for the &amp;lt;time&amp;gt; node, use &amp;quot;&amp;quot; for no metadata at all&lt;br /&gt;
&lt;br /&gt;
 Error Handling:&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
function p.Date(frame)&lt;br /&gt;
	return p._Date(	&lt;br /&gt;
		{ &lt;br /&gt;
			frame.args[&amp;quot;year&amp;quot;] or '', &lt;br /&gt;
			frame.args[&amp;quot;month&amp;quot;] or '',&lt;br /&gt;
			frame.args[&amp;quot;day&amp;quot;] or '', &lt;br /&gt;
			frame.args[&amp;quot;hour&amp;quot;] or '', &lt;br /&gt;
			frame.args[&amp;quot;minute&amp;quot;] or '', &lt;br /&gt;
			frame.args[&amp;quot;second&amp;quot;]or ''&lt;br /&gt;
		},&lt;br /&gt;
		frame.args[&amp;quot;lang&amp;quot;],                  -- language&lt;br /&gt;
		frame.args[&amp;quot;case&amp;quot;]  or '',           -- allows to specify grammatical case for the month for languages that use them&lt;br /&gt;
		frame.args[&amp;quot;class&amp;quot;] or 'dtstart',    -- allows to set the html class of the time node where the date is included. This is useful for microformats.&lt;br /&gt;
		frame.args[&amp;quot;trim_year&amp;quot;] or '100-999' -- by default pad one and 2 digit years to be 4 digit long, while keeping 3 digit years as is&lt;br /&gt;
	)	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function p._Date(datevec, lang, case, class, trim_year)	&lt;br /&gt;
	-- make sure inputs are in the right format&lt;br /&gt;
	if #datevec&amp;lt;6 then &lt;br /&gt;
		for i=#datevec,6,1 do datevec[i]='' end &lt;br /&gt;
	end&lt;br /&gt;
	if  not case  then case  = '' end&lt;br /&gt;
	if  not class then class = '' end&lt;br /&gt;
	if  not trim_year then trim_year = '100-999' end&lt;br /&gt;
&lt;br /&gt;
	-- if language is not provided than look up users language&lt;br /&gt;
	-- WARNING: This step should be done by the template as it does not seem to work as well here (cache issues?)&lt;br /&gt;
	if not lang or  not mw.language.isValidCode( lang ) then&lt;br /&gt;
		lang = mw.message.new( &amp;quot;lang&amp;quot; ):plain()&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Just in case someone broke the internationalization code than fix the english defaults&lt;br /&gt;
	if i18n.DateLang['en'] == nil then&lt;br /&gt;
		i18n.DateLang['en'] = 'en-form'&lt;br /&gt;
	end	&lt;br /&gt;
	if i18n.DateFormat['en-form'] == nil then&lt;br /&gt;
		i18n.DateFormat['en-form'] = {YMDHMS='j F Y, H:i:s', YMDHM='j F Y, H:i', YMD='j F Y', YM='F Y', MD='j F', Y='Y'}&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- create datecode based on which variables are provided and check for out of bound values&lt;br /&gt;
	local maxval = {9999, 12, 31, 23, 59, 60} -- max values for year, month, ...&lt;br /&gt;
	local c = {'Y', 'M', 'D', 'H', 'M', 'S'}&lt;br /&gt;
	local datecode = '' -- a string signifying which combination of variables was provided&lt;br /&gt;
	local datenum = {}  -- date-time encoded as a vector = [year, month, ... , second]&lt;br /&gt;
	for i, v in ipairs( datevec ) do&lt;br /&gt;
		if v~=nil and v~='' then&lt;br /&gt;
			datecode = datecode .. c[i]&lt;br /&gt;
			datenum[i] = tonumber(v)&lt;br /&gt;
			if datenum[i]==nil and i==2 then&lt;br /&gt;
				-- month is not a number -&amp;gt; check if it is a month name in English&lt;br /&gt;
				v = mw.language.new('en'):formatDate( &amp;quot;n&amp;quot;, v)&lt;br /&gt;
				datenum[i] = tonumber(v)&lt;br /&gt;
			end&lt;br /&gt;
			if datenum[i]==nil or datenum[i]&amp;gt;maxval[i] then&lt;br /&gt;
				-- Some numbers are out of range -&amp;gt; abort and return the empty string&lt;br /&gt;
				return ''&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- create time stamp string (for example 2000-02-20 02:20:20) based on which variables were provided&lt;br /&gt;
	local timeStamp&lt;br /&gt;
	if datecode == 'YMDHMS' then&lt;br /&gt;
		timeStamp = string.format('%04i-%02i-%02i %02i:%02i:%02i', datenum[1], datenum[2], datenum[3], datenum[4], datenum[5], datenum[6] )&lt;br /&gt;
	elseif datecode == 'YMDHM' then&lt;br /&gt;
		timeStamp = string.format('%04i-%02i-%02i %02i:%02i', datenum[1], datenum[2], datenum[3], datenum[4], datenum[5] )&lt;br /&gt;
	elseif datecode:sub(1,3)=='YMD' then&lt;br /&gt;
		timeStamp = string.format('%04i-%02i-%02i', datenum[1], datenum[2], datenum[3] )&lt;br /&gt;
		datecode = 'YMD' -- 'YMD', 'YMDHMS' and 'YMDHM' are the only supported format starting with 'YMD'. All others will be converted to 'YMD'&lt;br /&gt;
	elseif datecode == 'YM' then&lt;br /&gt;
		timeStamp = string.format('%04i-%02i', datenum[1], datenum[2] )&lt;br /&gt;
	elseif datecode:sub(1,1)=='Y' then&lt;br /&gt;
		timeStamp = string.format('%04i', datenum[1] )&lt;br /&gt;
		datecode = 'Y' &lt;br /&gt;
	elseif datecode == 'M' then&lt;br /&gt;
		timeStamp = string.format('%04i-%02i-%02i', 2000, datenum[2], 1 )&lt;br /&gt;
		class = '' -- date not complete -&amp;gt; no html formating or micro-tagging of date string&lt;br /&gt;
	elseif datecode == 'MD' then&lt;br /&gt;
		timeStamp = string.format('%04i-%02i-%02i', 2000, datenum[2], datenum[3] )&lt;br /&gt;
		class = '' -- date not complete -&amp;gt; no html formating or micro-tagging of date string&lt;br /&gt;
	else&lt;br /&gt;
		return ''  -- format not supported&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- ==========================================================&lt;br /&gt;
	-- === Create Date String using in chosen language&lt;br /&gt;
	-- ==========================================================&lt;br /&gt;
	&lt;br /&gt;
	-- which form should the date take? &lt;br /&gt;
	-- Use Fallback module to handle rare languages which are more likely to use different for than default EN form&lt;br /&gt;
	local langDateForm = Fallback._langSwitch(i18n.DateLang, lang)&lt;br /&gt;
	&lt;br /&gt;
	-- special case of French and Gallic dates, which require different date format for the 1st day of the month&lt;br /&gt;
	if datenum[3]==1 and (langDateForm=='fr-form' or langDateForm=='ga-form') then&lt;br /&gt;
		langDateForm = langDateForm .. '1' -- ordinal form for the first day of the month&lt;br /&gt;
	end&lt;br /&gt;
	-- Look up country specific format input to {{#time}} function&lt;br /&gt;
	local dFormat = i18n.DateFormat[langDateForm][datecode]&lt;br /&gt;
	&lt;br /&gt;
	-- overwrite default grammatical case of the month (applies mostly to Slavic languages)&lt;br /&gt;
	if (case=='gen') then&lt;br /&gt;
		-- CAUTION: at the moment i18n.DateFormat uses &amp;quot;F&amp;quot; only as month name, but this might change and this operation does not check if 'F' is in &amp;quot;&amp;quot; brackets or not, so if some language starts using 'F'  in &amp;quot;&amp;quot; than this will not work for that language&lt;br /&gt;
		dFormat = dFormat:gsub(&amp;quot;F&amp;quot;, &amp;quot;xg&amp;quot;); &lt;br /&gt;
	end&lt;br /&gt;
	if (case=='nom') then&lt;br /&gt;
		-- CAUTION: at the moment i18n.DateFormat uses &amp;quot;xg&amp;quot; only as month name, but this might change and this operation does not check if 'xg' is in &amp;quot;&amp;quot; brackets or not, so if some language starts using 'xg'  in &amp;quot;&amp;quot; than this will not work for that language&lt;br /&gt;
		dFormat = dFormat:gsub(&amp;quot;xg&amp;quot;, &amp;quot;F&amp;quot;);&lt;br /&gt;
	end&lt;br /&gt;
	if ((lang=='ru' or lang=='pl' or lang=='cs' or lang=='sl') and (case=='loc' or case=='ins')) or&lt;br /&gt;
		(lang=='fi' and (case=='ptv' or case=='ine'or case=='ela'or case=='ill') ) then&lt;br /&gt;
		local monthEn =  mw.language.new('en'):formatDate( &amp;quot;F&amp;quot;, timeStamp) -- month name in English&lt;br /&gt;
		-- month name using proper case and language. It relies on messages stored in MediaWiki namespace for some cases and languages&lt;br /&gt;
		-- That is why this IF statement uses &amp;quot;lang&amp;quot; not &amp;quot;langDateForm&amp;quot; variable to decide&lt;br /&gt;
		local monthMsg =  mw.message.new( string.format('%s-%s', monthEn, case ) ):inLanguage( lang )&lt;br /&gt;
		if not monthMsg:isDisabled() then -- make sure it exists&lt;br /&gt;
			local month=monthMsg:plain()&lt;br /&gt;
			dFormat = dFormat:gsub('F', '&amp;quot;'..month..'&amp;quot;'); -- replace default month with month name we already looked up&lt;br /&gt;
			dFormat = dFormat:gsub('xg', '&amp;quot;'..month..'&amp;quot;');&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- Special case related to Quechua and Kichwa languages&lt;br /&gt;
	-- see https://commons.wikimedia.org/wiki/Template_talk:Date#Quechua from 2014&lt;br /&gt;
	if (lang=='qu' or lang=='qug') and case=='nom' then&lt;br /&gt;
		dFormat = dFormat:gsub('F&amp;quot;pi&amp;quot;', 'F');&lt;br /&gt;
	end	&lt;br /&gt;
&lt;br /&gt;
	-- Lua only date formating using {{#time}} parser function (new)&lt;br /&gt;
		-- prefered call which gives &amp;quot;Lua error: too many language codes requested.&amp;quot; on the [[Module talk:Date/sandbox/testcases]] page&lt;br /&gt;
		--local datestr = mw.language.new(lang):formatDate( dFormat, timeStamp) &lt;br /&gt;
	local datestr = mw.getCurrentFrame():callParserFunction( &amp;quot;#time&amp;quot;, { dFormat, timeStamp, lang } )&lt;br /&gt;
	&lt;br /&gt;
	-- Another special case related to Thai solar calendar&lt;br /&gt;
	if lang=='th' and datenum[1]~= nil and datenum[1]&amp;lt;=1940 then&lt;br /&gt;
		-- As of 2014 {{#time}} parser function did not resolve those cases properly&lt;br /&gt;
		-- See https://en.wikipedia.org/wiki/Thai_solar_calendar#New_year for reference&lt;br /&gt;
		-- Disable once https://bugzilla.wikimedia.org/show_bug.cgi?id=66648 is fixed&lt;br /&gt;
		if datecode=='Y' then -- date is ambiguous&lt;br /&gt;
			datestr = string.format('%04i หรือ %04i', datenum[1]+542, datenum[1]+543 ) &lt;br /&gt;
		elseif datenum[2]&amp;lt;=3 then -- year is wrong (one too many)&lt;br /&gt;
			datestr = datestr:gsub( string.format('%04i', datenum[1]+543), string.format('%04i', datenum[1]+542 ) )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- If year&amp;lt;1000 than either keep it padded to the length of 4 digits or trim it&lt;br /&gt;
	-- decide if the year will stay padded with zeros (for years in 0-999 range)&lt;br /&gt;
	if datenum[1]~= nil and datenum[1]&amp;lt;1000 then&lt;br /&gt;
		local trim = yesno(trim_year,nil)&lt;br /&gt;
		if trim == nil then&lt;br /&gt;
			local YMin, YMax = trim_year:match( '(%d+)-(%d+)' )&lt;br /&gt;
			trim = (YMin~=nil and datenum[1]&amp;gt;=tonumber(YMin) and datenum[1]&amp;lt;=tonumber(YMax)) &lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		-- If the date form isn't the Thai solar calendar, don't zero pad years in the range of 100-999.  &lt;br /&gt;
		-- If at some point support for Islamic/Hebrew/Japanese years is added, they may need to be skipped as well. &lt;br /&gt;
		if trim then&lt;br /&gt;
			--local yearStr1 = mw.language.new(lang):formatDate( 'Y', timeStamp)&lt;br /&gt;
			local yearStr1 = mw.getCurrentFrame():callParserFunction( &amp;quot;#time&amp;quot;, { 'Y', timeStamp, lang } )&lt;br /&gt;
			--local yearStr1 = datestr:match( '%d%d%d%d' ) -- 4 digits in a row (in any language) - that must be a year&lt;br /&gt;
			local yearStr2 = yearStr1&lt;br /&gt;
			local zeroStr = mw.ustring.sub(yearStr1,1,1)&lt;br /&gt;
			for i=1,3 do -- trim leading zeros&lt;br /&gt;
				if mw.ustring.sub(yearStr2,1,1)==zeroStr then&lt;br /&gt;
					yearStr2 = mw.ustring.sub(yearStr2, 2, 5-i)&lt;br /&gt;
				else&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			datestr = datestr:gsub( yearStr1, yearStr2 )&lt;br /&gt;
			--datestr = string.format('%s (%s, %s)', datestr, yearStr1, yearStr2 )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- html formating and tagging of date string&lt;br /&gt;
	if class ~= '' then&lt;br /&gt;
		local DateHtmlTags = '&amp;lt;span style=&amp;quot;white-space:nowrap&amp;quot;&amp;gt;&amp;lt;time class=&amp;quot;%s&amp;quot; datetime=&amp;quot;%s&amp;quot;&amp;gt;%s&amp;lt;/time&amp;gt;&amp;lt;/span&amp;gt;'&lt;br /&gt;
		datestr = DateHtmlTags:format(class, timeStamp, datestr)&lt;br /&gt;
	end&lt;br /&gt;
	return datestr&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Jarekt</name></author>	</entry>

	</feed>