Modul:DateTime: Unterschied zwischen den Versionen

Zur Navigation springen Zur Suche springen
K (1 Version importiert: Bei Wikipedia von Löschung bedroht)
(2018-12-07, https://de.wikipedia.org/w/index.php?title=Wikipedia:Administratoren/Anfragen&curid=6974524&diff=183516299&oldid=183510463)
Zeile 1: Zeile 1:
local DateTime  = { serial = "2018-01-24",
local DateTime  = { serial = "2018-12-07",
                     suite  = "DateTime",
                     suite  = "DateTime",
                     item  = 20652535 }    -- Date and time objects
                     item  = 20652535 }    -- Date and time objects
Zeile 125: Zeile 125:
     -- Returns:
     -- Returns:
     --    string, HTML span
     --    string, HTML span
     return string.format( "<span class=\"error\">%s</span>", a )
     local e = mw.html.create( "span" )
                    :addClass( "error" )
                    :wikitext( a )
    return tostring( e )
end -- fault()
end -- fault()


Zeile 328: Zeile 331:
                         n    = min + m
                         n    = min + m
                     else    -- dom
                     else    -- dom
                         if adjust.month and adjust.year and  n > 1 and
                         if adjust.month and adjust.year  and
                           adjust.month >= 1  and
                           adjust.month >= 1  and
                           adjust.month <= 12 and
                           adjust.month <= 12 and
                           adjust.year > 1900 then
                           adjust.year > 1900 then
                             max = Calc.months[ adjust.month ]
                             if n > 0 then
                            if adjust.month == 2  and
                                max = Calc.final( adjust )
                              ( adjust.year % 4 ~= 0  or
                                while n > max do
                                adjust.year % 400 == 0 ) then
                                    n = n - max
                                 max = 28
                                    if adjust.month < 12 then
                             end
                                        adjust.month = adjust.month + 1
                            if n <= max then
                                    else
                                max = false
                                        adjust.month = 1
                                        adjust.year = adjust.year + 1
                                    end
                                    max = Calc.final( adjust )
                                 end    -- while n <= max
                             else
                                while n < 1 do
                                    if adjust.month == 1 then
                                        adjust.month = 12
                                        adjust.year  = adjust.year - 1
                                    else
                                        adjust.month = adjust.month - 1
                                    end
                                    max = Calc.final( adjust )
                                    n  = n + max
                                end    -- while n < 1
                             end
                             end
                        end
                        if max then
                            m    = n % 30
                            move = ( n - m )  /  30
                            n    = 1 + m
                         end
                         end
                     end
                     end
 
                end
                    end
                 adjust[ s ] = n
                 adjust[ s ] = n
             end
             end
Zeile 355: Zeile 367:
     end -- for i
     end -- for i
end -- Calc.fair()
end -- Calc.fair()
Calc.final = function ( adjust )
    -- Retrieve number of days in particular month
    -- Parameter:
    --    adjust  -- table, with date specification
    -- Returns:
    --    number, of days in month
    local r = Calc.months[ adjust.month ]
    if adjust.month == 2  and
      ( adjust.year % 4 ~= 0  or
        adjust.year % 400 == 0 ) then
        r = 28
    end
    return r
end -- Calc.final()




Zeile 1.162: Zeile 1.191:
     --    analyse  -- string to be interpreted
     --    analyse  -- string to be interpreted
     --    alien    -- string with language code, or nil
     --    alien    -- string with language code, or nil
     --    add      -- string, with interval (PHP strtotime), or nil
     --    add      -- table, with interval, or nil
     -- Returns:
     -- Returns:
     --    table, if parsed
     --    table, if parsed
Zeile 1.325: Zeile 1.354:
     --    add  -- string or number, to be added
     --    add  -- string or number, to be added
     -- Returns:
     -- Returns:
     --    string, with shift, or false/nil
     --    table, with shift, or false/nil
     local r
     local r
     if add then
     if add then
Zeile 1.332: Zeile 1.361:
             r = tonumber( add )
             r = tonumber( add )
             s = "number"
             s = "number"
        else
            r = add
         end
         end
         if s == "number" then
         if s == "number" then
Zeile 1.341: Zeile 1.368:
                 r = string.format( "%d second", r )
                 r = string.format( "%d second", r )
             end
             end
         elseif s ~= "string" then
         elseif s == "string" then
            r = add
        else
             r = false
             r = false
         end
         end
Zeile 1.827: Zeile 1.856:
     end
     end
     if r then
     if r then
         raw = r[ Meta.signature ]
         if r[ Meta.signature ] then
         rel = Private.future( shift )
            raw = r[ Meta.signature ]
         else
            raw = r
        end
        if type( shift ) == "table" then
            rel = shift
        else
            rel = Private.future( shift )
        end
     end
     end
     if raw and rel then
     if raw and rel then
Zeile 1.864: Zeile 1.901:
                   end
                   end
               end -- f()
               end -- f()
     for i = 2, 4 do
     for i = 2, 5 do
         f( i )
         f( i )
     end -- for i
     end -- for i
     r = s
     r = s
     s = ""
     s = ""
     for i = 5, 10 do
     for i = 6, 10 do
         f( i )
         f( i )
     end -- for i
     end -- for i
Zeile 2.147: Zeile 2.184:
         r = ( args.noerror or "0" )
         r = ( args.noerror or "0" )
         if r == "0" then
         if r == "0" then
             r = fault( "Format nicht erkannt" )
             r = fault( "Format invalid" )
         else
         else
             r = ""
             r = ""
Zeile 2.177: Zeile 2.214:
                 local vsn = entity:formatPropertyValues( "P348" )
                 local vsn = entity:formatPropertyValues( "P348" )
                 if type( vsn ) == "table"  and
                 if type( vsn ) == "table"  and
                   type( vsn.value) == "string" and
                   type( vsn.value ) == "string" and
                   vsn.value ~= "" then
                   vsn.value ~= "" then
                     r = vsn.value
                     r = vsn.value