<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ko">
	<id>https://wiki.theeum.com/index.php?action=history&amp;feed=atom&amp;title=%EB%AA%A8%EB%93%88%3ADate2</id>
	<title>모듈:Date2 - 편집 역사</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.theeum.com/index.php?action=history&amp;feed=atom&amp;title=%EB%AA%A8%EB%93%88%3ADate2"/>
	<link rel="alternate" type="text/html" href="https://wiki.theeum.com/index.php?title=%EB%AA%A8%EB%93%88:Date2&amp;action=history"/>
	<updated>2026-06-03T18:13:44Z</updated>
	<subtitle>이 문서의 편집 역사</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://wiki.theeum.com/index.php?title=%EB%AA%A8%EB%93%88:Date2&amp;diff=7445&amp;oldid=prev</id>
		<title>HyunJongSu: &quot;모듈:Date2&quot; 문서를 보호했습니다 ([편집=관리자만 허용] (무기한) [이동=관리자만 허용] (무기한))</title>
		<link rel="alternate" type="text/html" href="https://wiki.theeum.com/index.php?title=%EB%AA%A8%EB%93%88:Date2&amp;diff=7445&amp;oldid=prev"/>
		<updated>2023-03-18T20:48:18Z</updated>

		<summary type="html">&lt;p&gt;&amp;quot;&lt;a href=&quot;/wiki/%EB%AA%A8%EB%93%88:Date2&quot; title=&quot;모듈:Date2&quot;&gt;모듈:Date2&lt;/a&gt;&amp;quot; 문서를 보호했습니다 ([편집=관리자만 허용] (무기한) [이동=관리자만 허용] (무기한))&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;ko&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023년 3월 19일 (일) 05:48 판&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key eumwiki-eumwk_:diff::1.12:old-7444:rev-7445 --&gt;
&lt;/table&gt;</summary>
		<author><name>HyunJongSu</name></author>
	</entry>
	<entry>
		<id>https://wiki.theeum.com/index.php?title=%EB%AA%A8%EB%93%88:Date2&amp;diff=7444&amp;oldid=prev</id>
		<title>HyunJongSu: 새 문서: --     This module is intended for processing of date strings.  Please do not modify this code without applying the changes first at Module:Date/sandbox and testing  at Module:Date/sandbox/testcases and Module talk:Date/sandbox/testcases.  Authors and maintainers: * User:Parent5446 - original version of the function mimicking template:ISOdate * User:Jarekt - original version of the functions mimicking template:Date and template:ISOyear      local p = {}  -- =================...</title>
		<link rel="alternate" type="text/html" href="https://wiki.theeum.com/index.php?title=%EB%AA%A8%EB%93%88:Date2&amp;diff=7444&amp;oldid=prev"/>
		<updated>2023-03-18T20:48:07Z</updated>

		<summary type="html">&lt;p&gt;새 문서: --[[     This module is intended for processing of date strings.  Please do not modify this code without applying the changes first at Module:Date/sandbox and testing  at Module:Date/sandbox/testcases and Module talk:Date/sandbox/testcases.  Authors and maintainers: * User:Parent5446 - original version of the function mimicking template:ISOdate * User:Jarekt - original version of the functions mimicking template:Date and template:ISOyear  ]]    local p = {}  -- =================...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;새 문서&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(&amp;#039;Module:I18n/date&amp;#039;)		-- get localized translations of date formats&lt;br /&gt;
--local Fallback = require(&amp;#039;Module:Fallback&amp;#039;)			-- get fallback functions&lt;br /&gt;
local yesno    = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local i18n = {&lt;br /&gt;
	DateLang = {&lt;br /&gt;
		[&amp;#039;ko&amp;#039;] = &amp;#039;ko-form&amp;#039;&lt;br /&gt;
	},&lt;br /&gt;
	DateFormat = {&lt;br /&gt;
		[&amp;#039;ko-form&amp;#039;] = {&lt;br /&gt;
		YMD   =&amp;#039;Y년 F j일&amp;#039;,		&lt;br /&gt;
		YM    =&amp;#039;Y년 F&amp;#039;,		&lt;br /&gt;
		Y     =&amp;#039;Y&amp;#039;,&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&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 &amp;#039;&amp;#039;, &lt;br /&gt;
			frame.args[&amp;quot;month&amp;quot;] or &amp;#039;&amp;#039;,&lt;br /&gt;
			frame.args[&amp;quot;day&amp;quot;] or &amp;#039;&amp;#039;, &lt;br /&gt;
		},&lt;br /&gt;
		frame.args[&amp;quot;lang&amp;quot;] or &amp;#039;ko&amp;#039;,          -- language&lt;br /&gt;
		frame.args[&amp;quot;trim_year&amp;quot;] or &amp;#039;100-999&amp;#039; -- 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, 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]=&amp;#039;&amp;#039; end &lt;br /&gt;
	end&lt;br /&gt;
	if  not trim_year then trim_year = &amp;#039;100-999&amp;#039; 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 = &amp;#039;ko&amp;#039;&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[&amp;#039;ko&amp;#039;] == nil then&lt;br /&gt;
		i18n.DateLang[&amp;#039;ko&amp;#039;] = &amp;#039;ko-form&amp;#039;&lt;br /&gt;
	end	&lt;br /&gt;
	if i18n.DateFormat[&amp;#039;ko-form&amp;#039;] == nil then&lt;br /&gt;
		i18n.DateFormat[&amp;#039;ko-form&amp;#039;] =  {&lt;br /&gt;
		YMD   =&amp;#039;Y년 F j일&amp;#039;,		&lt;br /&gt;
		YM    =&amp;#039;Y년 F&amp;#039;,		&lt;br /&gt;
		Y     =&amp;#039;Y&amp;#039;,&lt;br /&gt;
	}&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} -- max values for year, month, ...&lt;br /&gt;
	local c = {&amp;#039;Y&amp;#039;, &amp;#039;M&amp;#039;, &amp;#039;D&amp;#039;}&lt;br /&gt;
	local datecode = &amp;#039;&amp;#039; -- 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~=&amp;#039;&amp;#039; 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(&amp;#039;en&amp;#039;):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 &amp;#039;&amp;#039;&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:sub(1,3)==&amp;#039;YMD&amp;#039; then&lt;br /&gt;
		timeStamp = string.format(&amp;#039;%04i-%02i-%02i&amp;#039;, datenum[1], datenum[2], datenum[3] )&lt;br /&gt;
		datecode = &amp;#039;YMD&amp;#039; -- &amp;#039;YMD&amp;#039;, &amp;#039;YMDHMS&amp;#039; and &amp;#039;YMDHM&amp;#039; are the only supported format starting with &amp;#039;YMD&amp;#039;. All others will be converted to &amp;#039;YMD&amp;#039;&lt;br /&gt;
	elseif datecode == &amp;#039;YM&amp;#039; then&lt;br /&gt;
		timeStamp = string.format(&amp;#039;%04i-%02i&amp;#039;, datenum[1], datenum[2] )&lt;br /&gt;
	elseif datecode:sub(1,1)==&amp;#039;Y&amp;#039; then&lt;br /&gt;
		timeStamp = string.format(&amp;#039;%04i&amp;#039;, datenum[1] )&lt;br /&gt;
		datecode = &amp;#039;Y&amp;#039; &lt;br /&gt;
	else&lt;br /&gt;
		return &amp;#039;&amp;#039;  -- 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 = &amp;#039;ko-form&amp;#039;&lt;br /&gt;
	&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;
	-- 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;
	-- 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( &amp;#039;(%d+)-(%d+)&amp;#039; )&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&amp;#039;t the Thai solar calendar, don&amp;#039;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( &amp;#039;Y&amp;#039;, timeStamp)&lt;br /&gt;
			local yearStr1 = mw.getCurrentFrame():callParserFunction( &amp;quot;#time&amp;quot;, { &amp;#039;Y&amp;#039;, timeStamp, lang } )&lt;br /&gt;
			--local yearStr1 = datestr:match( &amp;#039;%d%d%d%d&amp;#039; ) -- 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(&amp;#039;%s (%s, %s)&amp;#039;, datestr, yearStr1, yearStr2 )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return datestr&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>HyunJongSu</name></author>
	</entry>
</feed>