Modul:DateTime: Unterschied zwischen den Versionen

348 Bytes hinzugefügt ,  30. April 2017
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 = "2015-11-08" }    -- Date and time objects
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   = range.min or 0
             if range then
            max   = range.max  or  ( range.mod - 1 )
                min = range.min or 0
            if move then
                max = range.max  or  ( range.mod - 1 )
                n    = ( n or 0 )  +  move
                if move then
                move = false
                    n    = ( n or 0 )  +  move
            end
                    move = false
            if n < min  or  n > max then
                end
                if range.mod then
                if n < min  or  n > max then
                    m    = n % range.mod
                    if range.mod then
                    move = ( n - m )  /  range.mod
                        m    = n % range.mod
                    n    = min + m
                        move = ( n - m )  /  range.mod
                else    -- dom
                        n    = min + m
                    if adjust.month and adjust.year  and  n > 1  and
                    else    -- dom
                      adjust.month >= 1  and
                        if adjust.month and adjust.year  and  n > 1  and
                      adjust.month <= 12 and
                          adjust.month >= 1  and
                      adjust.year > 1900 then
                          adjust.month <= 12 and
                        max = Calc.months[ adjust.month ]
                          adjust.year > 1900 then
                        if adjust.month == 2  and
                            max = Calc.months[ adjust.month ]
                          ( adjust.year % 4 ~= 0  or
                            if adjust.month == 2  and
                            adjust.year % 400 == 0 ) then
                              ( adjust.year % 4 ~= 0  or
                             max = 28
                                adjust.year % 400 == 0 ) then
                                max = 28
                            end
                             if n <= max then
                                max = false
                            end
                         end
                         end
                         if n <= max then
                         if max then
                             max = false
                            m    = n % 30
                            move = ( n - m )  /  30
                             n    = 1 + m
                         end
                         end
                     end
                     end
                    if max then
 
                        m    = n % 30
                        move = ( n - m )  /  30
                        n    = 1 + m
                     end
                     end
                 end
                 adjust[ s ] = n
             end
             end
            adjust[ s ] = n
         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:lower()
             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
    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
            since = false
         end
         end
     end
     end
Anonymer Benutzer