20.564
Bearbeitungen
K (Entfernte den Schutz von „Modul:LinkSubformDatum“) |
(switch kal.month_names[] / kal.month_numbers[] von Modul:Kalender) |
||
| Zeile 1: | Zeile 1: | ||
local p = {} | local p = {} | ||
local | |||
local com = require( "Module:Common" ) | |||
local str = require("Modul:String") | local str = require("Modul:String") | ||
local kal = require("Modul:Kalender") | |||
function p.GetMonthday(frame) | function p.GetMonthday(frame) | ||
| Zeile 9: | Zeile 11: | ||
function p.getMonthday(date) | function p.getMonthday(date) | ||
local date_array = str.split(date, "/") | local date_array = str.split(date, "/") | ||
if | if com.isEmpty(date_array[2]) then | ||
-- When datestring contained no "/" | -- When datestring contained no "/" | ||
local mda = str.split(date_array[1]) | local mda = str.split(date_array[1]) | ||
if | if com.isEmpty(mda[2]) then | ||
-- When dateformat is just YYYY | -- When dateformat is just YYYY | ||
return "" | return "" | ||
| Zeile 22: | Zeile 23: | ||
end | end | ||
else | else | ||
mn = | mn = kal.month_names[tonumber(date_array[2])] | ||
date_array[3] = date_array[3]:gsub('0*', '', 1) | date_array[3] = date_array[3]:gsub('0*', '', 1) | ||
return date_array[3]:gsub("%s+", "") .. ". " .. mn | return date_array[3]:gsub("%s+", "") .. ". " .. mn | ||
| Zeile 35: | Zeile 36: | ||
function p.getYear(date) | function p.getYear(date) | ||
local date_array=str.split(date, "/") | local date_array=str.split(date, "/") | ||
if | if com.isEmpty(date_array[2]) then | ||
-- When datestring contained no "/" | -- When datestring contained no "/" | ||
local mda = str.split(date_array[1]) | local mda = str.split(date_array[1]) | ||
if | if com.isEmpty(mda[2]) then | ||
-- When dateformat is just YYYY | -- When dateformat is just YYYY | ||
return mda[1] | return mda[1] | ||
| Zeile 45: | Zeile 46: | ||
return mda[2] | return mda[2] | ||
end | end | ||
elseif | elseif com.isEmpty(date_array[3]) then | ||
-- Datestring contained one "/" | -- Datestring contained one "/" | ||
return date_array[1] | return date_array[1] | ||