<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="hr">
	<id>https://enciklopedija.cc/index.php?action=history&amp;feed=atom&amp;title=Modul%3ADatum_i_dob</id>
	<title>Modul:Datum i dob - Povijest promjena</title>
	<link rel="self" type="application/atom+xml" href="https://enciklopedija.cc/index.php?action=history&amp;feed=atom&amp;title=Modul%3ADatum_i_dob"/>
	<link rel="alternate" type="text/html" href="https://enciklopedija.cc/index.php?title=Modul:Datum_i_dob&amp;action=history"/>
	<updated>2026-08-05T23:29:10Z</updated>
	<subtitle>Povijest promjena ove stranice na wikiju</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://enciklopedija.cc/index.php?title=Modul:Datum_i_dob&amp;diff=752858&amp;oldid=prev</id>
		<title>Suradnik10: preuzeto s hr.wikipedije</title>
		<link rel="alternate" type="text/html" href="https://enciklopedija.cc/index.php?title=Modul:Datum_i_dob&amp;diff=752858&amp;oldid=prev"/>
		<updated>2026-04-10T01:43:38Z</updated>

		<summary type="html">&lt;p&gt;preuzeto s hr.wikipedije&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nova stranica&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
local formatirajDatum = require(&amp;#039;Module:Formatiraj datum&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local function getMinMaxIso(isoDatum)&lt;br /&gt;
    local y, m, d = isoDatum:match(&amp;#039;(%d+)-(%d+)-(%d+)&amp;#039;)&lt;br /&gt;
    if y then&lt;br /&gt;
        return isoDatum, isoDatum&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    y, m = isoDatum:match(&amp;#039;(%d+)-(%d+)&amp;#039;)&lt;br /&gt;
    if y and m then&lt;br /&gt;
        local maxDan = formatirajDatum.getMaxDan(y, m)&lt;br /&gt;
        local earliest = string.format(&amp;quot;%s-%s-01&amp;quot;, y, m)&lt;br /&gt;
        local latest = string.format(&amp;quot;%s-%s-%02d&amp;quot;, y, m, maxDan)&lt;br /&gt;
        return earliest, latest&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    y = isoDatum:match(&amp;#039;(%d+)&amp;#039;)&lt;br /&gt;
    if y then&lt;br /&gt;
        return y .. &amp;quot;-01-01&amp;quot;, y .. &amp;quot;-12-31&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return nil, nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function CalculateAge(isoPocetak, isoKraj)&lt;br /&gt;
    if not isoPocetak or not isoKraj then return nil end&lt;br /&gt;
&lt;br /&gt;
    local p_min, p_max = getMinMaxIso(isoPocetak)&lt;br /&gt;
    local k_min, k_max = getMinMaxIso(isoKraj)&lt;br /&gt;
&lt;br /&gt;
    if not p_min or not k_max then return nil end&lt;br /&gt;
&lt;br /&gt;
    local y1_min, m1_min, d1_min = p_max:match(&amp;#039;(%d+)-(%d+)-(%d+)&amp;#039;)&lt;br /&gt;
    local y2_min, m2_min, d2_min = k_min:match(&amp;#039;(%d+)-(%d+)-(%d+)&amp;#039;)&lt;br /&gt;
    y1_min, m1_min, d1_min = tonumber(y1_min), tonumber(m1_min), tonumber(d1_min)&lt;br /&gt;
    y2_min, m2_min, d2_min = tonumber(y2_min), tonumber(m2_min), tonumber(d2_min)&lt;br /&gt;
    local minGodine = y2_min - y1_min&lt;br /&gt;
    if (m2_min &amp;lt; m1_min) or (m2_min == m1_min and d2_min &amp;lt; d1_min) then&lt;br /&gt;
        minGodine = minGodine - 1&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local y1_max, m1_max, d1_max = p_min:match(&amp;#039;(%d+)-(%d+)-(%d+)&amp;#039;)&lt;br /&gt;
    local y2_max, m2_max, d2_max = k_max:match(&amp;#039;(%d+)-(%d+)-(%d+)&amp;#039;)&lt;br /&gt;
    y1_max, m1_max, d1_max = tonumber(y1_max), tonumber(m1_max), tonumber(d1_max)&lt;br /&gt;
    y2_max, m2_max, d2_max = tonumber(y2_max), tonumber(m2_max), tonumber(d2_max)&lt;br /&gt;
    local maxGodine = y2_max - y1_max&lt;br /&gt;
    if (m2_max &amp;lt; m1_max) or (m2_max == m1_max and d2_max &amp;lt; d1_max) then&lt;br /&gt;
        maxGodine = maxGodine - 1&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if minGodine &amp;lt; 0 or maxGodine &amp;gt; 122 then&lt;br /&gt;
        return nil&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if minGodine == maxGodine then&lt;br /&gt;
        if minGodine &amp;gt; 0 then&lt;br /&gt;
            return string.format(&amp;quot;%d god.&amp;quot;, minGodine)&lt;br /&gt;
        else&lt;br /&gt;
            local mjeseci = (y2_max - y1_max) * 12 + (m2_max - m1_max)&lt;br /&gt;
            if d2_max &amp;lt; d1_max then mjeseci = mjeseci - 1 end&lt;br /&gt;
            if mjeseci &amp;lt; 0 then mjeseci = 0 end&lt;br /&gt;
            return string.format(&amp;quot;%d mj.&amp;quot;, mjeseci)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        return string.format(&amp;quot;%d–%d god.&amp;quot;, minGodine, maxGodine)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.birth(frame)&lt;br /&gt;
    local args = frame.args&lt;br /&gt;
    local birthDate = mw.text.trim(args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
    local deathDate = mw.text.trim(args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    if birthDate == &amp;quot;&amp;quot; then return &amp;quot;&amp;quot; end&lt;br /&gt;
&lt;br /&gt;
    if string.find(birthDate, &amp;#039;god&amp;#039;, 1, true) or string.find(birthDate, &amp;#039;godina&amp;#039;, 1, true) or string.find(birthDate, &amp;#039;mj&amp;#039;, 1, true) or string.find(birthDate, &amp;#039;ForceAgeToShow&amp;#039;, 1, true) or string.find(birthDate, &amp;#039;dob&amp;#039;, 1, true) then&lt;br /&gt;
        return birthDate&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local bdaySpan = formatirajDatum.formatDateWithClass{ args = { [1] = birthDate, [2] = &amp;#039;bday&amp;#039; } }&lt;br /&gt;
    local ISObirth = formatirajDatum.getISO{ args = { [1] = birthDate } }&lt;br /&gt;
&lt;br /&gt;
    local visiblePart = birthDate&lt;br /&gt;
    local category = &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    local ns = mw.title.getCurrentTitle().namespace&lt;br /&gt;
    local title = mw.title.getCurrentTitle()&lt;br /&gt;
    if ns == 10 and not title.text:find(&amp;#039;/doc$&amp;#039;) and not title.text:find(&amp;#039;/testcases$&amp;#039;) and not title.text:find(&amp;#039;/sandbox$&amp;#039;) then&lt;br /&gt;
    category = &amp;#039;[[Kategorija:Predlošci koji koriste Modul:Datum i dob]]&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if deathDate == &amp;quot;&amp;quot; then&lt;br /&gt;
        if ISObirth then&lt;br /&gt;
            local today = mw.getContentLanguage():formatDate(&amp;#039;Y-m-d&amp;#039;)&lt;br /&gt;
            local age = CalculateAge(ISObirth, today)&lt;br /&gt;
            if age then&lt;br /&gt;
                visiblePart = visiblePart .. &amp;quot; (&amp;quot; .. age .. &amp;quot;)&amp;quot;&lt;br /&gt;
                if ns == 0 then&lt;br /&gt;
                    category = &amp;#039;[[Kategorija:Stranice s automatskim izračunom dobi osobe]]&amp;#039;&lt;br /&gt;
                end&lt;br /&gt;
            else&lt;br /&gt;
                if ns == 0 then&lt;br /&gt;
                    category = &amp;#039;[[Kategorija:Stranice bez izračuna dobi osobe]]&amp;#039;&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        else&lt;br /&gt;
            if ns == 0 then&lt;br /&gt;
                category = &amp;#039;[[Kategorija:Stranice bez izračuna dobi osobe]]&amp;#039;&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if bdaySpan ~= &amp;quot;&amp;quot; then&lt;br /&gt;
        return bdaySpan .. &amp;quot; &amp;quot; .. visiblePart .. category&lt;br /&gt;
    else&lt;br /&gt;
        return visiblePart .. category&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.death(frame)&lt;br /&gt;
    local args = frame.args&lt;br /&gt;
    local birthDate = mw.text.trim(args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
    local deathDate = mw.text.trim(args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    if deathDate == &amp;quot;&amp;quot; then&lt;br /&gt;
        return &amp;quot;&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if string.find(deathDate, &amp;#039;god&amp;#039;, 1, true) or string.find(deathDate, &amp;#039;godina&amp;#039;, 1, true) or string.find(deathDate, &amp;#039;mj&amp;#039;, 1, true) or string.find(deathDate, &amp;#039;ForceAgeToShow&amp;#039;, 1, true) or string.find(deathDate, &amp;#039;dob&amp;#039;, 1, true) then&lt;br /&gt;
        return deathDate&lt;br /&gt;
    end&lt;br /&gt;
    if string.find(birthDate, &amp;#039;god&amp;#039;, 1, true) or string.find(birthDate, &amp;#039;godina&amp;#039;, 1, true) or string.find(birthDate, &amp;#039;mj&amp;#039;, 1, true) or string.find(birthDate, &amp;#039;ForceAgeToShow&amp;#039;, 1, true) or string.find(birthDate, &amp;#039;dob&amp;#039;, 1, true) then&lt;br /&gt;
        return deathDate&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local ISObirth = formatirajDatum.getISO{ args = { [1] = birthDate } }&lt;br /&gt;
    local ISOdeath = formatirajDatum.getISO{ args = { [1] = deathDate } }&lt;br /&gt;
&lt;br /&gt;
    local display = deathDate&lt;br /&gt;
    local ns = mw.title.getCurrentTitle().namespace&lt;br /&gt;
    local title = mw.title.getCurrentTitle()&lt;br /&gt;
    local category = &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    if ns == 10 and not title.text:find(&amp;#039;/doc$&amp;#039;) and not title.text:find(&amp;#039;/testcases$&amp;#039;) and not title.text:find(&amp;#039;/sandbox$&amp;#039;) then&lt;br /&gt;
        category = &amp;#039;[[Kategorija:Predlošci koji koriste Modul:Datum i dob]]&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if ISObirth and ISOdeath then&lt;br /&gt;
        local age = CalculateAge(ISObirth, ISOdeath)&lt;br /&gt;
        if age then&lt;br /&gt;
            display = display .. &amp;quot; (&amp;quot; .. age .. &amp;quot;)&amp;quot;&lt;br /&gt;
            if ns == 0 then&lt;br /&gt;
                category = &amp;#039;[[Kategorija:Stranice s automatskim izračunom dobi osobe]]&amp;#039;&lt;br /&gt;
            end&lt;br /&gt;
        else&lt;br /&gt;
            if ns == 0 then&lt;br /&gt;
                category = &amp;#039;[[Kategorija:Stranice bez izračuna dobi osobe]]&amp;#039;&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        if ns == 0 then&lt;br /&gt;
            category = &amp;#039;[[Kategorija:Stranice bez izračuna dobi osobe]]&amp;#039;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return display .. category&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Suradnik10</name></author>
	</entry>
</feed>