Modul:DateTime: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
2017-04-29
K (Änderte den Schutz von „Modul:DateTime“: per Anfrage: https://de.wikipedia.org/w/index.php?title=Wikipedia%3AAdministratoren%2FAnfragen&type=revision&diff=156076713&oldid=156073630 ([Bearbeiten=Nur Sichter] (unbeschränkt) [Verschieben=Nur Adm…) |
(2017-04-29) |
||
Zeile 1: | Zeile 1: | ||
local DateTime = { serial = " | local DateTime = { serial = "2017-04-29", | ||
suite = "DateTime" } -- Date and time objects | |||
local Calc = { } | local Calc = { } | ||
local Meta = { } | local Meta = { } | ||
Zeile 313: | Zeile 314: | ||
if n or move then | if n or move then | ||
range = ranges[ s ] | range = ranges[ s ] | ||
min | if range then | ||
min = range.min or 0 | |||
max = range.max or ( range.mod - 1 ) | |||
if move then | |||
n = ( n or 0 ) + move | |||
move = false | |||
end | |||
if n < min or n > max then | |||
if range.mod then | |||
m = n % range.mod | |||
move = ( n - m ) / range.mod | |||
n = min + m | |||
else -- dom | |||
if adjust.month and adjust.year and n > 1 and | |||
adjust.month >= 1 and | |||
adjust.month <= 12 and | |||
adjust.year > 1900 then | |||
max = Calc.months[ adjust.month ] | |||
if adjust.month == 2 and | |||
( adjust.year % 4 ~= 0 or | |||
max = | adjust.year % 400 == 0 ) then | ||
max = 28 | |||
end | |||
if n <= max then | |||
max = false | |||
end | |||
end | end | ||
if n | if max then | ||
m = n % 30 | |||
move = ( n - m ) / 30 | |||
n = 1 + m | |||
end | end | ||
end | end | ||
end | end | ||
adjust[ s ] = n | |||
end | end | ||
end | end | ||
end -- for i | end -- for i | ||
Zeile 1.659: | Zeile 1.663: | ||
local i = adapt.lang:find( "-", 3, true ) | local i = adapt.lang:find( "-", 3, true ) | ||
if i then | if i then | ||
slang = adapt.lang | slang = adapt.lang:lower() | ||
opts.lang = slang:sub( 1, i - 1 ) | opts.lang = slang:sub( 1, i - 1 ) | ||
else | else | ||
opts.lang = adapt.lang | opts.lang = adapt.lang:lower() | ||
end | end | ||
end | end | ||
opts.lang = opts.lang | opts.lang = opts.lang | ||
opts.london = adapt.london | opts.london = adapt.london | ||
opts.lonely = adapt.lonely | opts.lonely = adapt.lonely | ||
Zeile 2.152: | Zeile 2.156: | ||
function p.failsafe( frame ) | function p.failsafe( frame ) | ||
local since = frame.args[ 1 ] | local s = type( frame ) | ||
local r, since | |||
if s == "table" then | |||
since = frame.args[ 1 ] | |||
elseif s == "string" then | |||
since = frame | |||
end | |||
if since then | if since then | ||
since = mw.text.trim( since ) | since = mw.text.trim( since ) | ||
if since == "" then | if since == "" then | ||
since = false | |||
end | end | ||
end | end |