Modul:DateTime: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
update
(Setup) |
(update) |
||
Zeile 1: | Zeile 1: | ||
--[=[ 2014-01- | --[=[ 2014-01-29 | ||
Date and time utilities | Date and time utilities | ||
]=] | ]=] | ||
Zeile 209: | Zeile 209: | ||
r = false | r = false | ||
end | end | ||
elseif sx then | elseif sx and sx ~= "" then | ||
r = false | r = false | ||
end | end | ||
Zeile 397: | Zeile 397: | ||
rS = "" | rS = "" | ||
else | else | ||
local s2 | local s2, s3 | ||
n = mw.ustring.len( s ) + 1 | n = mw.ustring.len( s ) + 1 | ||
s = mw.ustring.sub( analyse, n ) | s = mw.ustring.sub( analyse, n ) | ||
s, | s2 = s:match( "^ (%d%d%d?%d?)$" ) | ||
if s2 then | |||
rO.year = tonumber( s2 ) | |||
rS = "" | |||
else | |||
s2, s3, rS = s:match( "^ (%d+), (%d+)( ?.*)$" ) | |||
if s2 and s3 then | |||
n = #s2 | |||
if n <= 2 and #s3 == 4 then | |||
rO.dom = tonumber( n ) | |||
rO.year = tonumber( s3 ) | |||
rO.dom2 = ( n == 2 ) | |||
else | |||
rO = false | |||
end | |||
else | else | ||
rO = false | rO = false | ||
end | end | ||
end | end | ||
end | end | ||
Zeile 657: | Zeile 663: | ||
s, sign, shift, sub = analyse:match( s ) | s, sign, shift, sub = analyse:match( s ) | ||
if sign then | if sign then | ||
if sub then | if s:find( ":%d%d *$" ) then | ||
if sub then | |||
if #sub == 2 then | |||
rO.zone = tonumber( shift .. sub ) | |||
else | |||
rO = false | |||
end | |||
else | else | ||
rO = | rO.zone = tonumber( shift ) * 100 | ||
end | end | ||
if rO then | |||
if sign == "-" then | |||
rO.zone = - rO.zone | |||
end | |||
rS = mw.text.trim( s ) | |||
end | end | ||
end | end | ||
elseif analyse:find( "%(.*%)$" ) then | elseif analyse:find( "%(.*%)$" ) then | ||
Zeile 1.080: | Zeile 1.088: | ||
if type( template ) == "table" then | if type( template ) == "table" then | ||
r1 = template.spec | r1 = template.spec | ||
if assigned.year then | |||
if not assigned.dom then | |||
r1 = r1:gsub( "[ ./]?[jJ][ ./,]*", "" ) | |||
:gsub( "^ ", "" ) | |||
if not assigned.month then | |||
r1 = r1:gsub( "[ ./]?[fFmM][ ./]*", "" ) | |||
end | |||
end | |||
else | |||
r1 = r1:gsub( " ?[yY] ?", "" ) | |||
end | |||
if template.lift then | if template.lift then | ||
local spec = "T. Monat JJJJ hh:mm:ss Zone" | local spec = "T. Monat JJJJ hh:mm:ss Zone" | ||
Zeile 1.092: | Zeile 1.111: | ||
stamp = "H:i:s" | stamp = "H:i:s" | ||
if assigned.msec then | if assigned.msec then | ||
stamp = string.format( "%s. | stamp = string.format( "%s.%d", | ||
stamp, assigned.msec ) | stamp, assigned.msec ) | ||
end | end |