Modul:LinkFormDatum: Unterschied zwischen den Versionen

keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 17: Zeile 17:
      
      
     mw.smw.set({[attr_date] = date})
     mw.smw.set({[attr_date] = date})
     if isEmpty(date_array[2]) then
     if c.isEmpty(date_array[2]) then
     -- When datestring contained no "/"
     -- When datestring contained no "/"
     if isInteger(date_array[1]) then
     if p.isInteger(date_array[1]) then
     -- When dateformat is just YYYY
     -- When dateformat is just YYYY
     return "[[" .. attr_year .. "::" .. date_array[1] .. "]]"
     return "[[" .. attr_year .. "::" .. date_array[1] .. "]]"
Zeile 27: Zeile 27:
     return mda[1] .. " [[" .. attr_year .. "::" .. mda[2] .. "]]"
     return mda[1] .. " [[" .. attr_year .. "::" .. mda[2] .. "]]"
     end
     end
     elseif isEmpty(date_array[3]) then
     elseif c.isEmpty(date_array[3]) then
     -- Datestring contained one "/"
     -- Datestring contained one "/"
     local mn = months[tonumber(date_array[2])]
     local mn = months[tonumber(date_array[2])]
Zeile 47: Zeile 47:
function p.format_date(date)
function p.format_date(date)
local date_array = str.split(date, " ")
local date_array = str.split(date, " ")
if isEmpty(date_array[2]) then
if c.isEmpty(date_array[2]) then
     -- When datestring contained no " ", thus is year
     -- When datestring contained no " ", thus is year
     return "[[" .. date_array[1] .. "]]"
     return "[[" .. date_array[1] .. "]]"
elseif isEmpty(date_array[3]) then
elseif c.isEmpty(date_array[3]) then
-- When datestring contains monthname and year
-- When datestring contains monthname and year
return date_array[1] .. " [[" .. date_array[2] .. "]]"
return date_array[1] .. " [[" .. date_array[2] .. "]]"
Zeile 69: Zeile 69:
function p.human_to_form_date(date)
function p.human_to_form_date(date)
local date_array=str.split(date, " ")
local date_array=str.split(date, " ")
if isEmpty(date_array[2]) then
if c.isEmpty(date_array[2]) then
-- When datestring contained no " ", thus is year
-- When datestring contained no " ", thus is year
return date_array[1]
return date_array[1]
elseif isEmpty(date_array[3]) then
elseif c.isEmpty(date_array[3]) then
-- When datestring contains monthname and year
-- When datestring contains monthname and year
return date_array[1].." "..date_array[1]
return date_array[1].." "..date_array[1]
82.367

Bearbeitungen