15.075
Bearbeitungen
(linkFormDate auch ohne Attribute) |
(linkFormDate() zusätzlich ISO-P case YYYY-MM-DD) |
||
| Zeile 11: | Zeile 11: | ||
function p.linkFormDate(date, attr_date, attr_day, attr_year) | function p.linkFormDate(date, attr_date, attr_day, attr_year) | ||
local months = c.getMonthList() | local months = c.getMonthList() | ||
local date_array | local date_array | ||
local mda | local mda | ||
local mn -- monthname | local mn -- monthname | ||
if string.find(date, "/") ~= nil then -- regular case YYYY/MM/DD | |||
date_array = str.split(date, "/") | |||
else -- ISO-P case YYYY-MM-DD | |||
date_array = str.split(date, "-") | |||
end | |||
-- wenn keine Attribute übergeben, werden keine gesetzt, sondern nur Links eingebaut | -- wenn keine Attribute übergeben, werden keine gesetzt, sondern nur Links eingebaut | ||
| Zeile 44: | Zeile 50: | ||
return mn .. " [[" .. attr_year .. date_array[1] .. "]]" | return mn .. " [[" .. attr_year .. date_array[1] .. "]]" | ||
else | else | ||
-- Dateformat should be YYYY/MM/DD | -- Dateformat should be YYYY/MM/DD or YYYY-MM-DD | ||
mn = months[tonumber(date_array[2])] | mn = months[tonumber(date_array[2])] | ||
date_array[3] = date_array[3]:gsub('0*', '', 1) | date_array[3] = date_array[3]:gsub('0*', '', 1) | ||