Modul:Dato og alder/sandkasse
Utseende
Lua-feil i Modul:Documentation, linje 388: message: type error in message cfg.module-sandbox-category (string expected, got nil).
local p = {}
local formatISOdate = require('Modul:ISOtilNorskdato').formatIsoDate
local lang = mw.getContentLanguage()
function p.bd(frame)
if not mw.wikibase then
return ""
end
local artikkel = mw.wikibase.getEntity()
if not artikkel then
return "[[Kategori:Artikler som mangler på Wikidata]]"
end
local claims = artikkel.claims
if not claims then
return "[[Kategori:Artikler som mangler utsagn på Wikidata]]"
end
local p569 = claims.p569
if not p569 then
return ""
end
local birthdate = p569[0].mainsnak.datavalue.value["time"]
if not birthdate then
return ""
end
birth_date = string.sub(birthdate,2,5) .. '-' .. string.sub(birthdate,7,8) .. '-' .. string.sub(birthdate,10,11)
local bdOut = formatISOdate(birth_date)
return bdOut
end
return p