Modul:Fødselsår
Dokumentasjon for denne modulen kan opprettes på Modul:Fødselsår/dok
local p = {} local mw = require("mw") function p.y(frame) local entity = mw.wikibase.getEntityObject() -- If the page is not connected to Wikidata if not entity then return "" end -- Check if the entity has a birth date (P569) if entity.claims and entity.claims["P569"] then local dob = entity.claims["P569"][1].mainsnak.datavalue.value.time local year = string.sub(dob, 2, 5) -- Extract YYYY if tonumber(year) then return year end end -- If no birth date is found, return a message and add a category return "Ikke oppgitt [[Kategori:Sider uten fødselsår på Wikidata]]" end return p