https://de.wikipedia.org/w/index.php?action=history&feed=atom&title=Modul%3AFormatDateTest
Modul:FormatDateTest - Versionsgeschichte
2025-06-09T14:41:42Z
Versionsgeschichte dieser Seite in Wikipedia
MediaWiki 1.45.0-wmf.4
https://de.wikipedia.org/w/index.php?title=Modul:FormatDateTest&diff=139773495&oldid=prev
Antonsusi: umbau Split
2015-03-14T15:29:26Z
<p>umbau Split</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="de">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Nächstältere Version</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version vom 14. März 2015, 17:29 Uhr</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Zeile 25:</td>
<td colspan="2" class="diff-lineno">Zeile 25:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> str = mw.ustring.sub(str,pos+1, -1);</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> str = mw.ustring.sub(str,pos+1, -1);</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> pos = mw.ustring.find(str,'-',1,true);</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> pos = mw.ustring.find(str,'-',1,true);</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not pos or pos == 0 then</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not pos or pos == 0 then</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;">return true, </del>Datum<del style="font-weight: bold; text-decoration: none;">;</del> <del style="font-weight: bold; text-decoration: none;">--</del> <del style="font-weight: bold; text-decoration: none;">Nur</del> <del style="font-weight: bold; text-decoration: none;">Jahr</del></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> Datum<ins style="font-weight: bold; text-decoration: none;">.m</ins> <ins style="font-weight: bold; text-decoration: none;">=</ins> <ins style="font-weight: bold; text-decoration: none;">tonumber(str)</ins> <ins style="font-weight: bold; text-decoration: none;">or</ins> <ins style="font-weight: bold; text-decoration: none;">0</ins></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker"><a class="mw-diff-movedpara-right" title="Der Absatz wurde verschoben. Klicken, um zur alten Stelle zu springen." href="#movedpara_8_1_lhs">⚫</a></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_4_0_rhs"></a> Datum.d = 0;</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker"><a class="mw-diff-movedpara-right" title="Der Absatz wurde verschoben. Klicken, um zur alten Stelle zu springen." href="#movedpara_8_2_lhs">⚫</a></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_4_1_rhs"></a> return true, Datum;</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Teil = mw.ustring.sub(str,1,pos-1)</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Teil = mw.ustring.sub(str,1,pos-1)</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Datum.m = tonumber(Teil) or 0</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Datum.m = tonumber(Teil) or 0</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Teil = mw.ustring.sub(str,pos+1, -1)</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Teil = mw.ustring.sub(str,pos+1, -1)</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> if #Teil == 0 then</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker"><a class="mw-diff-movedpara-left" title="Der Absatz wurde verschoben. Klicken, um zur neuen Stelle zu springen." href="#movedpara_4_0_rhs">⚫</a></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_8_1_lhs"></a> Datum.d = 0;</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker"><a class="mw-diff-movedpara-left" title="Der Absatz wurde verschoben. Klicken, um zur neuen Stelle zu springen." href="#movedpara_4_1_rhs">⚫</a></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_8_2_lhs"></a> return true, Datum;<del style="font-weight: bold; text-decoration: none;"> -- Nur Jahr und Monat</del></div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Datum.d = tonumber(Teil) or 0;</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Datum.d = tonumber(Teil) or 0;</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> return true, Datum;</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> return true, Datum;</div></td>
</tr>
</table>
Antonsusi
https://de.wikipedia.org/w/index.php?title=Modul:FormatDateTest&diff=139771646&oldid=prev
Antonsusi: +Kommentar
2015-03-14T14:24:02Z
<p>+Kommentar</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="de">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Nächstältere Version</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version vom 14. März 2015, 16:24 Uhr</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Zeile 71:</td>
<td colspan="2" class="diff-lineno">Zeile 71:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> return true, Datum;</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> return true, Datum;</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> if Datum.y % 4 == 0 then</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> if Datum.y % 4 == 0 then<ins style="font-weight: bold; text-decoration: none;"> -- Die greg. Sonderregeln werden ignoriert.</ins></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if Datum.d > 29 then -- nach Februar (Schaltjahr)</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if Datum.d > 29 then -- nach Februar (Schaltjahr)</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Datum.m = 3;</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Datum.m = 3;</div></td>
</tr>
</table>
Antonsusi
https://de.wikipedia.org/w/index.php?title=Modul:FormatDateTest&diff=139771281&oldid=prev
Antonsusi: +Info
2015-03-14T14:13:13Z
<p>+Info</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="de">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Nächstältere Version</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version vom 14. März 2015, 16:13 Uhr</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Zeile 1:</td>
<td colspan="2" class="diff-lineno">Zeile 1:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local p = {}</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local p = {}</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> -- ACHTUNG! Das Modul dient der Erprobung und ist nicht für den dauerhaften Einsatz vorgesehen!</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Trennen der Parameter</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Trennen der Parameter</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local function Split(str)</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local function Split(str)</div></td>
</tr>
</table>
Antonsusi
https://de.wikipedia.org/w/index.php?title=Modul:FormatDateTest&diff=139771149&oldid=prev
Antonsusi: AZ: Die Seite wurde neu angelegt: local p = {} -- Trennen der Parameter local function Split(str) local Datum = {} local Teil=""…
2015-03-14T14:09:05Z
<p><a href="/wiki/Hilfe:Zusammenfassung_und_Quellen#Auto-Zusammenfassung" title="Hilfe:Zusammenfassung und Quellen">AZ</a>: Die Seite wurde neu angelegt: local p = {} -- Trennen der Parameter local function Split(str) local Datum = {} local Teil=""…</p>
<p><b>Neue Seite</b></p><div>local p = {}<br />
-- Trennen der Parameter<br />
local function Split(str)<br />
local Datum = {}<br />
local Teil=""<br />
local pos = 0<br />
Datum.y = 0<br />
Datum.m = 0<br />
Datum.d = 0<br />
pos = mw.ustring.find(str,'-',1,true);<br />
if pos == 1 then -- Minuszeichen am Anfang - nochmal suchen<br />
pos = mw.ustring.find(str,'-',2,true);<br />
end<br />
if not pos then -- Bereits am Stringende<br />
Datum.y = tonumber(str);<br />
if Datum.y then<br />
return true, Datum -- Nur eine Jahreszahl<br />
else<br />
return false, Datum -- Kein Wert erkennbar<br />
end<br />
end<br />
Teil = mw.ustring.sub(str,1,pos-1);<br />
Datum.y = tonumber(Teil) or 0;<br />
str = mw.ustring.sub(str,pos+1, -1);<br />
pos = mw.ustring.find(str,'-',1,true);<br />
if not pos or pos == 0 then<br />
return true, Datum; -- Nur Jahr<br />
end<br />
Teil = mw.ustring.sub(str,1,pos-1)<br />
Datum.m = tonumber(Teil) or 0<br />
Teil = mw.ustring.sub(str,pos+1, -1)<br />
if #Teil == 0 then<br />
Datum.d = 0;<br />
return true, Datum; -- Nur Jahr und Monat<br />
end<br />
Datum.d = tonumber(Teil) or 0;<br />
return true, Datum;<br />
end<br />
--<br />
<br />
local function CheckDate(Date)<br />
-- Monatspruefung<br />
if Date.m == 0 then -- keine Pruefung<br />
return true;<br />
end<br />
if Date.m > 12 or Date.m < 1 then<br />
return false;<br />
end<br />
if Date.d == 0 then -- nur Monat angegeben, keine Tagespruefung<br />
return true;<br />
end<br />
if ( Date.m == 4 or Date.m == 6 or Date.m == 9 or Date.m == 11) and Date.d > 30 then<br />
return false;<br />
end<br />
if Date.m == 2 then -- Die greg. Sonderregeln werden ignoriert.<br />
if Date.y % 4 ~= 0 and Date.d > 28 then return false; end<br />
if Date.y % 4 == 0 and Date.d > 29 then return false; end<br />
end<br />
-- Hier nur noch 31-Tage-Monate übrig.<br />
if Date.d > 31 then return false; end<br />
return true;<br />
end<br />
--<br />
local function TageInMonate(Datum)<br />
Datum.m = 1;<br />
if Datum.d > 31 then -- nach Januar<br />
Datum.m = 2;<br />
Datum.d = Datum.d - 31;<br />
else<br />
return true, Datum;<br />
end<br />
if Datum.y % 4 == 0 then<br />
if Datum.d > 29 then -- nach Februar (Schaltjahr)<br />
Datum.m = 3;<br />
Datum.d = Datum.d - 29;<br />
else<br />
return true, Datum;<br />
end<br />
else<br />
if Datum.d > 28 then -- nach Februar (Normaljahr)<br />
Datum.m = 3;<br />
Datum.d = Datum.d - 28;<br />
else<br />
return true, Datum;<br />
end<br />
end<br />
if Datum.d > 31 then -- nach Maerz<br />
Datum.m = 4;<br />
Datum.d = Datum.d - 31;<br />
else<br />
return true, Datum;<br />
end<br />
if Datum.d > 30 then -- nach April<br />
Datum.m = 5;<br />
Datum.d = Datum.d - 30;<br />
else<br />
return true, Datum;<br />
end<br />
if Datum.d > 31 then -- nach Mai<br />
Datum.m = 6;<br />
Datum.d = Datum.d - 31;<br />
else<br />
return true, Datum;<br />
end<br />
if Datum.d > 30 then -- nach Juni<br />
Datum.m = 7;<br />
Datum.d = Datum.d - 30;<br />
else<br />
return true, Datum;<br />
end<br />
if Datum.d > 31 then -- nach Juli<br />
Datum.m = 8;<br />
Datum.d = Datum.d - 31;<br />
else<br />
return true, Datum;<br />
end<br />
if Datum.d > 31 then -- nach August<br />
Datum.m = 9;<br />
Datum.d = Datum.d - 31;<br />
else<br />
return true, Datum;<br />
end<br />
if Datum.d > 30 then -- nach September<br />
Datum.m = 10;<br />
Datum.d = Datum.d - 30;<br />
else<br />
return true, Datum;<br />
end<br />
if Datum.d > 31 then -- nach Oktober<br />
Datum.m = 11;<br />
Datum.d = Datum.d - 31;<br />
else<br />
return true, Datum;<br />
end<br />
if Datum.d > 30 then -- nach November<br />
Datum.m = 12;<br />
Datum.d = Datum.d - 30;<br />
else<br />
return true, Datum;<br />
end<br />
if Datum.d > 31 then -- nach Dezember = Fehler<br />
Datum.m = 0;<br />
Datum.d = 0;<br />
return false, Datum;<br />
else<br />
return true, Datum;<br />
end<br />
end<br />
--<br />
<br />
local function Run(Args)<br />
local T_L = {"Januar","Februar", "März", "April", "Mai","Juni", "Juli", "August","September","Oktober","November","Dezember","Jänner"}<br />
local T_M = {"Jan.","Feb.", "März", "Apr.", "Mai","Juni", "Juli", "Aug.","Sep.","Okt.","Nov.","Dez.","Jän."}<br />
local T_S = {"Jan.","Feb.", "Mrz.", "Apr.", "Mai","Jun.", "Jul.", "Aug.","Sep.","Okt.","Nov.","Dez.","Jän."}<br />
local Text = "";<br />
local TextYear = "";<br />
local TextMonth = "";<br />
local TextDay = "";<br />
local idxm = 0 ; -- Wegen der AT-Regel ein Extraindex fuer den Monat.<br />
local AT = false;<br />
local NBSP = false;<br />
local LINK = false;<br />
local VCHR = "";<br />
local STIL = 'L';<br />
local IsOk = true;<br />
local Tbl = {}<br />
local SortIt = false;<br />
local Zero = false;<br />
local Numstr = "";<br />
local SortTag= "";<br />
local Arg2 = mw.ustring.lower(mw.text.trim(Args[2] or ""));<br />
local Arg3 = mw.ustring.lower(mw.text.trim(Args[3] or ""));<br />
local Arg4 = mw.ustring.lower(mw.text.trim(Args[4] or ""));<br />
local davor = mw.text.trim(Args['davor'] or "");<br />
if Arg2 == "nbsp" or Arg3 == "nbsp" or Arg4 == "nbsp" then NBSP = true; end<br />
if Arg2 == "link" or Arg3 == "link" or Arg4 == "link" then LINK = true; end<br />
if Arg2 == "l" or Arg3 == "l" or Arg4 == "l" then STIL = 'L'; end<br />
if Arg2 == "m" or Arg3 == "m" or Arg4 == "m" then STIL = 'M'; end<br />
if Arg2 == "s" or Arg3 == "s" or Arg4 == "s" then STIL = 'S'; end<br />
if mw.ustring.lower(mw.text.trim(Args['AT'] or "")) == "ja" then AT = true; end<br />
if mw.ustring.lower(mw.text.trim(Args['Zero'] or "")) ~= "" then Zero = true; end<br />
if mw.ustring.lower(mw.text.trim(Args['Sort'] or "")) ~= "" then SortIt = true; Zero = true; end<br />
if davor ~="" then davor = davor .. "&nbsp;"; end<br />
IsOk, Tbl = Split(Args[1])<br />
if not IsOk then<br />
Text = '<span class="error">[[Vorlage:FormatDate]]: Kein gültiges ISO-Datum!</span>'<br />
return Text<br />
end<br />
--Tage ohne Monat: Tage in Monat und Tag umrechnen<br />
if Tbl.m == 0 and Tbl.d ~= 0 then<br />
IsOk, Tbl = TageInMonate(Tbl)<br />
end<br />
if not IsOk then<br />
Text = '<span class="error">[[Vorlage:FormatDate]]: Kein gültiges ISO-Datum!</span>'<br />
return Text<br />
end<br />
Tbl.y = tonumber(Tbl.y) or 0;<br />
if Tbl.y == 0 and Tbl.m == 0 and Tbl.d == 0 then<br />
Text = '<span class="error">[[Vorlage:FormatDate]]: Ungültiger Wert ("0-0-0") für das Datum! </span>'<br />
return Text<br />
end<br />
if Tbl.y < 0 then -- Jahr Null reserviert fuer "Nur Tag und Monat"<br />
Tbl.y = 0 - Tbl.y<br />
VCHR = ' v. Chr.';<br />
end<br />
<br />
IsOk = CheckDate(Tbl);<br />
if not IsOk then<br />
Text = '<span class="error">[[Vorlage:FormatDate]]: Ungültiges Datum!'.. table.concat(Tbl,'.')..'</span>'<br />
return Text<br />
end<br />
<br />
if Tbl.d > 0 then -- Tag angegeben, String erstellen<br />
TextDay = tostring(Tbl.d) .. '.&nbsp;'<br />
if Tbl.d < 10 and Zero then<br />
TextDay = '<span style="visibility:hidden;">0</span>' .. TextDay;<br />
end<br />
else<br />
TextDay = '';<br />
end<br />
<br />
if Tbl.m > 0 then -- Monat angegeben, String erstellen<br />
if AT and Tbl.m == 1 then<br />
idxm = 13<br />
else<br />
idxm = Tbl.m;<br />
end<br />
<br />
if STIL == 'S' then<br />
TextMonth = T_S[idxm] ;<br />
elseif STIL == 'M' then<br />
TextMonth = T_M[idxm] ;<br />
else<br />
TextMonth = T_L[idxm] ;<br />
end<br />
<br />
Text = TextDay .. TextMonth<br />
if LINK then<br />
if Tbl.d == 0 then<br />
Linkziel =T_L[Tbl.m]<br />
else<br />
Linkziel = tostring(Tbl.d) .. ". " .. T_L[Tbl.m]<br />
end<br />
Text = '[[' .. Linkziel .. '|' .. Text .. ']]';<br />
end<br />
end<br />
-- hier Tag und Monat zusammen, evtl. verlinkt<br />
<br />
if Tbl.y ~= 0 then<br />
if LINK then<br />
TextYear = '[[' .. tostring(Tbl.y) .. VCHR .. ']]';<br />
else<br />
TextYear = tostring(Tbl.y) .. VCHR;<br />
end<br />
if Tbl.m > 0 then<br />
if NBSP then<br />
TextYear = '&nbsp;' .. TextYear;<br />
else<br />
TextYear = ' ' .. TextYear;<br />
end<br />
end<br />
end<br />
Text = Text .. TextYear;<br />
<br />
if SortIt then<br />
if VCHR ~= "" then<br />
Tbl.y = 0 - Tbl.y<br />
end<br />
Numstr = string.format('%d%2.2d%2.2d',5000+Tbl.y,Tbl.m,Tbl.d);<br />
SortTag='<span style="display:none" class="sortkey">' .. Numstr .. '</span>';<br />
Text = SortTag .. davor .. Text;<br />
end<br />
return Text<br />
end<br />
--<br />
<br />
function p.Execute(frame)<br />
local FR = frame:getParent()<br />
return Run(FR.args)<br />
end<br />
<br />
function p.Sort(frame)<br />
local FR = frame:getParent()<br />
FR.args.Sort='1'<br />
return Run(FR.args)<br />
end<br />
return p</div>
Antonsusi