 <?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mwstake.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AYMD_to_ISO</id>
	<title>Module:YMD to ISO - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mwstake.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AYMD_to_ISO"/>
	<link rel="alternate" type="text/html" href="https://mwstake.org/w/index.php?title=Module:YMD_to_ISO&amp;action=history"/>
	<updated>2026-04-29T14:04:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://mwstake.org/w/index.php?title=Module:YMD_to_ISO&amp;diff=1541&amp;oldid=prev</id>
		<title>Mark Hershberger: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://mwstake.org/w/index.php?title=Module:YMD_to_ISO&amp;diff=1541&amp;oldid=prev"/>
		<updated>2019-04-23T17:56:48Z</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 13:56, 23 April 2019&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>Mark Hershberger</name></author>
	</entry>
	<entry>
		<id>https://mwstake.org/w/index.php?title=Module:YMD_to_ISO&amp;diff=1540&amp;oldid=prev</id>
		<title>enwiki&gt;Pppery at 23:25, 1 March 2019</title>
		<link rel="alternate" type="text/html" href="https://mwstake.org/w/index.php?title=Module:YMD_to_ISO&amp;diff=1540&amp;oldid=prev"/>
		<updated>2019-03-01T23:25:37Z</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 p = {}&lt;br /&gt;
&lt;br /&gt;
local function month_number(month_name)&lt;br /&gt;
    local months_full = {january=1, february=2, march=3, april=4, may=5, june=6, july=7, august=8, september=9, october=10, november=11, december=12}&lt;br /&gt;
    local months_abbr = {jan=1, feb=2, mar=3, apr=4, may=5, jun=6, jul=7, aug=8, sep=9, oct=10, nov=11, dec=12}&lt;br /&gt;
    local month_lc, _ = string.gsub(string.lower(month_name),'%.','',1)&lt;br /&gt;
    local month_num = months_full[month_lc] or months_abbr[month_lc] or 0&lt;br /&gt;
    if month_lc == 'sept' then&lt;br /&gt;
        month_num = 9&lt;br /&gt;
    end&lt;br /&gt;
    return month_num&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function days_in_month(month_num,year)&lt;br /&gt;
    -- modified from code in Module:Citation/CS1/Date_validation&lt;br /&gt;
    local days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}&lt;br /&gt;
    local month_length&lt;br /&gt;
    if month_num == 2 then         -- February: 28 days, unless leap year&lt;br /&gt;
        month_length = 28&lt;br /&gt;
        if year &amp;lt;= 1582 then       -- Julian calendar before Oct 1582&lt;br /&gt;
            if (year%4) == 0 then&lt;br /&gt;
                month_length = 29  -- if leap year, then 29 days&lt;br /&gt;
            end&lt;br /&gt;
        else                       -- Gregorian calendar since Oct 1582&lt;br /&gt;
            if ( (year%4)==0 and ((year%100)~=0 or (year%400)==0) ) then  &lt;br /&gt;
                month_length = 29  -- if leap year, then 29 days   &lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    else                           -- not February, get number of days for month&lt;br /&gt;
        month_length = days[month_num]&lt;br /&gt;
    end&lt;br /&gt;
    return month_length&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function zero_pad(string)&lt;br /&gt;
    if string.len(string) == 1 then&lt;br /&gt;
        return '0' .. string&lt;br /&gt;
    else&lt;br /&gt;
        return string&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
    if frame.args[1] == nil then&lt;br /&gt;
        return ''     -- first argument is missing&lt;br /&gt;
    end&lt;br /&gt;
    local arg1, _ = string.gsub(mw.text.trim(frame.args[1]),'_',' ')&lt;br /&gt;
    return p._main(arg1)&lt;br /&gt;
end&lt;br /&gt;
function p._main(arg1)&lt;br /&gt;
    if arg1 == '' then&lt;br /&gt;
        return ''     -- first argument is empty&lt;br /&gt;
    end&lt;br /&gt;
    if not arg1:match('^%d%d%d%d %a%a%a%a?%.?%a?%a?%a?%a?%a?%a? *%d%d?$') then&lt;br /&gt;
        return arg1   -- invalid date pattern&lt;br /&gt;
    end&lt;br /&gt;
    local year, month_name, day = string.match(arg1, '^(%d%d%d%d) *(%a%a%a%a?%.?%a?%a?%a?%a?%a?%a?) *(%d%d?)$')&lt;br /&gt;
    if month_number(month_name) == 0 then&lt;br /&gt;
        return arg1   -- invalid month name or abbreviation&lt;br /&gt;
    end&lt;br /&gt;
    if tonumber(day) &amp;lt; 1 or tonumber(day) &amp;gt; days_in_month(month_number(month_name),tonumber(year)) then&lt;br /&gt;
        return arg1   -- invalid day number for given month&lt;br /&gt;
    end&lt;br /&gt;
    return year .. '-' .. zero_pad(tostring(month_number(month_name))) .. '-' .. zero_pad(day)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>enwiki&gt;Pppery</name></author>
	</entry>
</feed>