<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.maoism.ru/index.php?action=history&amp;feed=atom&amp;title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3AWikidata%2Fdate</id>
	<title>Модуль:Wikidata/date - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.maoism.ru/index.php?action=history&amp;feed=atom&amp;title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3AWikidata%2Fdate"/>
	<link rel="alternate" type="text/html" href="http://wiki.maoism.ru/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Wikidata/date&amp;action=history"/>
	<updated>2026-05-13T15:03:50Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.maoism.ru/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Wikidata/date&amp;diff=1285&amp;oldid=prev</id>
		<title>Maoism archivist: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.maoism.ru/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Wikidata/date&amp;diff=1285&amp;oldid=prev"/>
		<updated>2020-10-15T08:07:13Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия 11:07, 15 октября 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Maoism archivist</name></author>
	</entry>
	<entry>
		<id>http://wiki.maoism.ru/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Wikidata/date&amp;diff=1284&amp;oldid=prev</id>
		<title>wiki&gt;Carn: аналогично для неизвестных дат смерти в случае nocat</title>
		<link rel="alternate" type="text/html" href="http://wiki.maoism.ru/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Wikidata/date&amp;diff=1284&amp;oldid=prev"/>
		<updated>2020-06-01T18:58:54Z</updated>

		<summary type="html">&lt;p&gt;аналогично для неизвестных дат смерти в случае nocat&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--settings&lt;br /&gt;
local categoryUnknownBirthDate = '[[Категория:Персоналии, чья дата рождения не установлена]]';&lt;br /&gt;
local categoryUnknownDeathDate = '[[Категория:Персоналии, чья дата смерти не установлена]]';&lt;br /&gt;
local categoryBigCurrentAge = '[[Категория:Википедия:Статьи о персоналиях с большим текущим возрастом]]'&lt;br /&gt;
-- local categoryBigDeathAge = '[[Категория:Википедия:Статьи о персоналиях с большим возрастом во время смерти]]' //deleted -d.bratchuk 05-07-2016&lt;br /&gt;
local categoryBiographiesOfLivingPersons = '[[Категория:Википедия:Биографии современников]]'&lt;br /&gt;
local categoryRecentlyDeceased = '[[Категория:Википедия:Персоналии, умершие менее года назад]]'&lt;br /&gt;
local nowLabel = 'наст.&amp;amp;nbsp;время'&lt;br /&gt;
&lt;br /&gt;
local moduleDates = require( &amp;quot;Module:Dates&amp;quot; )&lt;br /&gt;
local moduleWikidata = require( &amp;quot;Module:Wikidata&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
local function deepcopy(orig)&lt;br /&gt;
    local orig_type = type(orig)&lt;br /&gt;
    local copy&lt;br /&gt;
    if orig_type == 'table' then&lt;br /&gt;
        copy = {}&lt;br /&gt;
        for orig_key, orig_value in next, orig, nil do&lt;br /&gt;
            copy[deepcopy(orig_key)] = deepcopy(orig_value)&lt;br /&gt;
        end&lt;br /&gt;
        setmetatable(copy, deepcopy(getmetatable(orig)))&lt;br /&gt;
    else -- number, string, boolean, etc&lt;br /&gt;
        copy = orig&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function ageImpl ( bStructure, bPrecision, dStructure, dPrecision )&lt;br /&gt;
	if ( not bStructure or not dStructure or bPrecision &amp;lt; 10 or dPrecision &amp;lt; 10 ) then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local shift = 0;&lt;br /&gt;
	if ( bStructure.year &amp;lt; 0 and dStructure.year &amp;gt; 0 ) then&lt;br /&gt;
		shift = -1;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
 	if ( bPrecision == 10 or dPrecision == 10 ) then&lt;br /&gt;
 		if ( bStructure.month &amp;lt; dStructure.month ) then&lt;br /&gt;
 			return dStructure.year - bStructure.year + shift&lt;br /&gt;
 		end&lt;br /&gt;
 		if ( bStructure.month == dStructure.month ) then&lt;br /&gt;
 			return nil&lt;br /&gt;
 		end&lt;br /&gt;
 		if ( bStructure.month &amp;gt; dStructure.month ) then&lt;br /&gt;
 			return dStructure.year - bStructure.year - 1 + shift&lt;br /&gt;
 		end&lt;br /&gt;
 	end&lt;br /&gt;
 &lt;br /&gt;
  	if ( bStructure.month &amp;lt; dStructure.month ) then&lt;br /&gt;
 		return dStructure.year - bStructure.year + shift&lt;br /&gt;
 	end&lt;br /&gt;
 	if ( bStructure.month == dStructure.month ) then&lt;br /&gt;
	  	if ( bStructure.day &amp;lt;= dStructure.day ) then&lt;br /&gt;
	 		return dStructure.year - bStructure.year + shift&lt;br /&gt;
	 	else &lt;br /&gt;
	 		return dStructure.year - bStructure.year - 1 + shift&lt;br /&gt;
 		end&lt;br /&gt;
 	end&lt;br /&gt;
 	if ( bStructure.month &amp;gt; dStructure.month ) then&lt;br /&gt;
 		return dStructure.year - bStructure.year - 1 + shift&lt;br /&gt;
 	end&lt;br /&gt;
&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- accepts table of time+precision values&lt;br /&gt;
local function ageCurrent ( bTable )&lt;br /&gt;
	local possibleAge = &amp;quot;NYA&amp;quot; -- it meansm &amp;quot;Not Yet Assigned&amp;quot;, not what you imagined!&lt;br /&gt;
&lt;br /&gt;
	for bKey, bValue in pairs(bTable) do&lt;br /&gt;
		if ( bValue.unknown ) then&lt;br /&gt;
			return nil&lt;br /&gt;
		end&lt;br /&gt;
		local bStructure = bValue.structure&lt;br /&gt;
		local bPrecision = bValue.precision&lt;br /&gt;
&lt;br /&gt;
		local dStructure = os.date( &amp;quot;*t&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
		local calculatedAge = ageImpl ( bStructure, bPrecision, dStructure, 11 )&lt;br /&gt;
		if ( possibleAge == &amp;quot;NYA&amp;quot; ) then&lt;br /&gt;
			possibleAge = calculatedAge&lt;br /&gt;
		else&lt;br /&gt;
			if ( possibleAge ~= calculatedAge ) then&lt;br /&gt;
				possibleAge = nil&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return possibleAge&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- accepts tables of time+precision values&lt;br /&gt;
local function age ( bTable, dTable )&lt;br /&gt;
	local possibleAge = &amp;quot;NYA&amp;quot; -- it meansm &amp;quot;Not Yet Assigned&amp;quot;, not what you imagined!&lt;br /&gt;
&lt;br /&gt;
	for bKey, bValue in pairs( bTable ) do&lt;br /&gt;
		if ( bValue.unknown ) then&lt;br /&gt;
			return nil&lt;br /&gt;
		end&lt;br /&gt;
		local bStructure = bValue.structure&lt;br /&gt;
		local bPrecision = bValue.precision&lt;br /&gt;
&lt;br /&gt;
		for dKey, dValue in pairs( dTable ) do&lt;br /&gt;
			if ( dValue.unknown ) then&lt;br /&gt;
				return nil&lt;br /&gt;
			end&lt;br /&gt;
			local dStructure = dValue.structure&lt;br /&gt;
			local dPrecision = dValue.precision&lt;br /&gt;
			if ( bValue.calendar == 'julian' and dValue.calendar == 'gregorian' ) then&lt;br /&gt;
				-- to calculate age, need to adjust bStructure to gregorian calendar&lt;br /&gt;
				local shift = math.floor(bStructure.year/100-2) - math.floor(bStructure.year/400)&lt;br /&gt;
				-- TODO: re-implement this properly&lt;br /&gt;
				bStructure.day = bStructure.day + shift&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			local calculatedAge = ageImpl ( bStructure, bPrecision, dStructure, dPrecision )&lt;br /&gt;
			if ( possibleAge == &amp;quot;NYA&amp;quot; ) then&lt;br /&gt;
				possibleAge = calculatedAge&lt;br /&gt;
			else&lt;br /&gt;
				if ( possibleAge ~= calculatedAge ) then&lt;br /&gt;
					possibleAge = nil&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return possibleAge&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function parseISO8601Date(str)&lt;br /&gt;
	local pattern = &amp;quot;(%-?%d+)%-(%d+)%-(%d+)T&amp;quot;&lt;br /&gt;
	local Y, M, D = mw.ustring.match( str, pattern )&lt;br /&gt;
	return tonumber(Y), tonumber(M), tonumber(D)&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
local function parseISO8601Time(str)&lt;br /&gt;
	local pattern = &amp;quot;T(%d+):(%d+):(%d+)%Z&amp;quot;&lt;br /&gt;
	local H, M, S = mw.ustring.match( str, pattern)&lt;br /&gt;
	return tonumber(H), tonumber(M), tonumber(S)&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
local function parseISO8601Offset(str)&lt;br /&gt;
	if str:sub(-1)==&amp;quot;Z&amp;quot; then return 0,0 end -- ends with Z, Zulu time&lt;br /&gt;
 &lt;br /&gt;
	-- matches ±hh:mm, ±hhmm or ±hh; else returns nils &lt;br /&gt;
	local pattern = &amp;quot;([-+])(%d%d):?(%d?%d?)$&amp;quot;&lt;br /&gt;
	local sign, oh, om = mw.ustring.match( str, pattern) &lt;br /&gt;
	sign, oh, om = sign or &amp;quot;+&amp;quot;, oh or &amp;quot;00&amp;quot;, om or &amp;quot;00&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
	return tonumber(sign .. oh), tonumber(sign .. om)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function parseISO8601(str)&lt;br /&gt;
	if 'table' == type(str) then&lt;br /&gt;
		if str.args and str.args[1] then&lt;br /&gt;
			str = '' .. str.args[1]&lt;br /&gt;
		else&lt;br /&gt;
			return 'unknown argument type: ' .. type( str ) .. ': ' .. table.tostring( str )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Y,M,D = parseISO8601Date(str)&lt;br /&gt;
	local h,m,s = parseISO8601Time(str)&lt;br /&gt;
	local oh,om = parseISO8601Offset(str)&lt;br /&gt;
&lt;br /&gt;
	if not Y or not M or not D or not h or not m or not s or not oh or not om then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return tonumber(os.time({year=Y, month=M, day=D, hour=(h+oh), min=(m+om), sec=s}))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function parseClaim ( claim )&lt;br /&gt;
	if ( claim.mainsnak.snaktype == &amp;quot;value&amp;quot; ) then&lt;br /&gt;
		-- The calendar model used for saving the data is always the proleptic Gregorian calendar according to ISO 8601.&lt;br /&gt;
		local timeISO8601 = string.gsub( string.gsub( tostring( claim.mainsnak.datavalue.value.time ), '-00%-', '-01-' ), '-00T', '-01T' )&lt;br /&gt;
		local unixtime = parseISO8601( timeISO8601 )&lt;br /&gt;
		local structure = os.date(&amp;quot;*t&amp;quot;, unixtime)&lt;br /&gt;
		local precision = tonumber( claim.mainsnak.datavalue.value.precision )&lt;br /&gt;
		local calendarmodel = 'gregorian';&lt;br /&gt;
		if (mw.ustring.find(claim.mainsnak.datavalue.value.calendarmodel, 'Q1985786', 1, true)) then&lt;br /&gt;
			calendarmodel = 'julian';&lt;br /&gt;
		end&lt;br /&gt;
		local item = { structure=structure, precision=precision, calendar = calendarmodel }&lt;br /&gt;
		return item;&lt;br /&gt;
	elseif ( claim.mainsnak.snaktype == &amp;quot;novalue&amp;quot; ) then&lt;br /&gt;
		-- novalue&lt;br /&gt;
		return { unknown=&amp;quot;novalue&amp;quot; };&lt;br /&gt;
	else&lt;br /&gt;
		--unknown &lt;br /&gt;
		return { unknown=&amp;quot;unknown&amp;quot; };&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- returns table of time+precision values for specified property&lt;br /&gt;
local function parseProperty ( context, options, propertyId )&lt;br /&gt;
	if ( not context ) then error( 'context not specified'); end;&lt;br /&gt;
	if ( not options ) then error( 'options not specified'); end;&lt;br /&gt;
	if ( not options.entity ) then error( 'options.entity is missing'); end;&lt;br /&gt;
	if ( not propertyId ) then error( 'propertyId not specified'); end;&lt;br /&gt;
&lt;br /&gt;
	local claims = context.selectClaims( options, propertyId );&lt;br /&gt;
	if not claims then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local result = {}&lt;br /&gt;
	for key, claim in pairs( claims ) do&lt;br /&gt;
		table.insert ( result, parseClaim( claim ) );&lt;br /&gt;
	end&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- проверка на совпадающие даты с разной моделью календаря&lt;br /&gt;
local function checkDupDates( t )&lt;br /&gt;
	if #t &amp;gt; 1 then&lt;br /&gt;
		local removed = false;&lt;br /&gt;
		local j = 1;&lt;br /&gt;
		-- проверка на совпадающие даты с разной моделью календаря&lt;br /&gt;
		while (j &amp;lt;= #t)  do&lt;br /&gt;
			local i = 1;&lt;br /&gt;
			while (i &amp;lt;= #t)  do&lt;br /&gt;
				if i ~= j then&lt;br /&gt;
					if (os.time(t[j].structure) == os.time(t[i].structure)) then&lt;br /&gt;
						if ((t[j].calendarmodel == 'gregorian') and &lt;br /&gt;
							(t[i].calendarmodel == 'julian')) then&lt;br /&gt;
							removed = true;&lt;br /&gt;
							break;&lt;br /&gt;
						else&lt;br /&gt;
							table.remove(t, i)&lt;br /&gt;
						end&lt;br /&gt;
					else&lt;br /&gt;
					  i = i + 1;&lt;br /&gt;
					end&lt;br /&gt;
				else&lt;br /&gt;
					i = i + 1;&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if removed then&lt;br /&gt;
				removed = false;&lt;br /&gt;
				table.remove(t, j);&lt;br /&gt;
			else&lt;br /&gt;
				j = j+1;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- returns first qualifier of specified propertyId&lt;br /&gt;
local function getQualifierDataValue( statement, qualifierPropertyId )&lt;br /&gt;
	if ( statement.qualifiers&lt;br /&gt;
			and statement.qualifiers[qualifierPropertyId] ) then&lt;br /&gt;
		local qualifiers = statement.qualifiers[qualifierPropertyId];&lt;br /&gt;
		for _, qualifier in ipairs( qualifiers ) do&lt;br /&gt;
			if (qualifier.datavalue) then&lt;br /&gt;
				return qualifier.datavalue;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return nil;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local brcs = 0&lt;br /&gt;
&lt;br /&gt;
function p.formatDateOfBirthClaimX( context, options, statement )&lt;br /&gt;
	brcs = 1&lt;br /&gt;
	return p.formatDateOfBirthClaim( context, options, statement )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function formatDecade( time, categoryNamePrefix )&lt;br /&gt;
	if ( time.year &amp;lt; 0 ) then&lt;br /&gt;
		local year = math.floor( math.abs(time.year) / 10 ) * 10;&lt;br /&gt;
		if ( categoryNamePrefix ) then&lt;br /&gt;
			return year .. '-е до н. э.[[Category:' .. categoryNamePrefix .. ' в ' .. year .. '-е годы до н. э.]]';&lt;br /&gt;
		else&lt;br /&gt;
			return '' .. year .. ' до н. э.';&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		local year = math.floor( time.year / 10 ) * 10;&lt;br /&gt;
		if ( categoryNamePrefix ) then&lt;br /&gt;
			return year .. '-е[[Category:' .. categoryNamePrefix .. ' в ' .. year .. '-е годы]]';&lt;br /&gt;
		else&lt;br /&gt;
			return '' .. year;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function formatCentury( time, categoryNamePrefix )&lt;br /&gt;
	local moduleRoman = require( &amp;quot;Module:RomanNumber&amp;quot; )&lt;br /&gt;
	if ( time.year &amp;lt; 0 ) then&lt;br /&gt;
		local century = math.floor( (math.abs( time.year) - 1) / 100 ) + 1;&lt;br /&gt;
        local infix = ' в ';&lt;br /&gt;
        if century == 2 then infix = ' во '; end;&lt;br /&gt;
		if ( moduleRoman ) then&lt;br /&gt;
			century = moduleRoman.toRomanNumber( century );&lt;br /&gt;
		end&lt;br /&gt;
		if ( categoryNamePrefix ) then&lt;br /&gt;
			return '[[' .. century .. ' век до н. э.]][[Category:' .. categoryNamePrefix .. infix .. century .. ' веке до н. э.]]'&lt;br /&gt;
		else&lt;br /&gt;
			return '[[' .. century .. ' век до н. э.]]'&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		local century = math.floor( (time.year - 1) / 100 ) + 1;&lt;br /&gt;
        local infix = ' в ';&lt;br /&gt;
        if (century == 2) then infix = ' во ' end;&lt;br /&gt;
		if ( moduleRoman ) then&lt;br /&gt;
			century = moduleRoman.toRomanNumber( century );&lt;br /&gt;
		end&lt;br /&gt;
		if ( categoryNamePrefix ) then&lt;br /&gt;
			return '[[' .. century .. ' век]][[Category:' .. categoryNamePrefix .. infix .. century .. ' веке]]'&lt;br /&gt;
		else&lt;br /&gt;
			return '[[' .. century .. ' век]]'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function formatMillenium( time, categoryNamePrefix )&lt;br /&gt;
	if ( time.year &amp;lt; 0 ) then&lt;br /&gt;
		local millenium = math.floor( (math.abs( time.year) - 1) / 1000 ) + 1;&lt;br /&gt;
		if ( categoryNamePrefix ) then&lt;br /&gt;
			if ( millenium == 2 ) then&lt;br /&gt;
				return '[[' .. millenium .. '-е тысячелетие до н. э.]][[Category:' .. categoryNamePrefix .. ' во ' .. millenium .. '-м тысячелетии до н. э.]]'&lt;br /&gt;
			else	&lt;br /&gt;
				return '[[' .. millenium .. '-е тысячелетие до н. э.]][[Category:' .. categoryNamePrefix .. ' в ' .. millenium .. '-м тысячелетии до н. э.]]'&lt;br /&gt;
			end	&lt;br /&gt;
		else&lt;br /&gt;
			return '[[' .. millenium .. '-е тысячелетие до н. э.]]'&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		local millenium = math.floor( (time.year - 1) / 1000 ) + 1;&lt;br /&gt;
		if ( categoryNamePrefix ) then&lt;br /&gt;
			if ( millenium == 2 ) then&lt;br /&gt;
				return '[[' .. millenium .. '-е тысячелетие]][[Category:' .. categoryNamePrefix .. ' во ' .. millenium .. '-м тысячелетии]]'&lt;br /&gt;
			else&lt;br /&gt;
				return '[[' .. millenium .. '-е тысячелетие]][[Category:' .. categoryNamePrefix .. ' в ' .. millenium .. '-м тысячелетии]]'&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			return '[[' .. millenium .. '-е тысячелетие]]'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function formatDateImpl( value, options, microformatClass, categoryPrefix )&lt;br /&gt;
	if ( not value ) then error( 'value not specified'); end;&lt;br /&gt;
	if ( not options ) then error( 'options not specified'); end;&lt;br /&gt;
&lt;br /&gt;
	-- The calendar model used for saving the data is always the proleptic Gregorian calendar according to ISO 8601.&lt;br /&gt;
	local timeISO8601 = string.gsub( string.gsub( tostring( value.time ), '-00%-', '-01-' ), '-00T', '-01T' )&lt;br /&gt;
	local unixtime = parseISO8601( timeISO8601 )&lt;br /&gt;
	&lt;br /&gt;
	if not unixtime then&lt;br /&gt;
		return ''&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local structure = os.date(&amp;quot;*t&amp;quot;, unixtime)&lt;br /&gt;
	local precision = tonumber( value.precision )&lt;br /&gt;
	&lt;br /&gt;
	if precision &amp;lt;= 6 then&lt;br /&gt;
		return formatMillenium(structure, categoryPrefix)&lt;br /&gt;
	end	&lt;br /&gt;
	if precision == 7 then&lt;br /&gt;
		return formatCentury(structure, categoryPrefix)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if precision == 8 then&lt;br /&gt;
		return formatDecade(structure, categoryPrefix)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if precision == 9 then&lt;br /&gt;
		local tCopy = deepcopy( structure )&lt;br /&gt;
		tCopy.day = nil&lt;br /&gt;
		tCopy.month = nil&lt;br /&gt;
		return moduleDates.formatWikiImpl(tCopy, tCopy, infoclass, categoryPrefix)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- year and month only&lt;br /&gt;
	if precision == 10 then&lt;br /&gt;
		local tCopy = deepcopy( structure )&lt;br /&gt;
		tCopy.day = nil&lt;br /&gt;
		return moduleDates.formatWikiImpl(tCopy, tCopy, infoclass, categoryPrefix)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local calendarmodel = 'gregorian';&lt;br /&gt;
	if (mw.ustring.find(value.calendarmodel, 'Q1985786', 1, true)) then&lt;br /&gt;
		calendarmodel = 'julian';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (calendarmodel == 'gregorian') then&lt;br /&gt;
    	return moduleDates.formatWikiImpl( structure, structure, microformatClass, categoryPrefix )&lt;br /&gt;
    else&lt;br /&gt;
		return p.formatAsJulian( unixtime, infoclass, categoryPrefix )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.formatDateOfBirthClaim( context, options, statement )&lt;br /&gt;
	if ( not context ) then error( 'context not specified'); end;&lt;br /&gt;
	if ( not options ) then error( 'options not specified'); end;&lt;br /&gt;
	if ( not options.entity ) then error( 'options.entity is missing'); end;&lt;br /&gt;
	if ( not statement ) then error( 'statement not specified'); end;&lt;br /&gt;
	if options.nocat then categoryUnknownBirthDate = &amp;quot;&amp;quot; end&lt;br /&gt;
	&lt;br /&gt;
	local qNotSoonerThan = getQualifierDataValue( statement, 'P1319' );&lt;br /&gt;
	local qNotLaterThan = getQualifierDataValue( statement, 'P1326' );&lt;br /&gt;
	if ( qNotSoonerThan or qNotLaterThan ) then&lt;br /&gt;
		local results = {};&lt;br /&gt;
		if ( qNotSoonerThan ) then&lt;br /&gt;
			table.insert( results, 'не&amp;amp;nbsp;ранее&amp;amp;nbsp;' .. formatDateImpl( qNotSoonerThan.value, {}, nil, nil ) );&lt;br /&gt;
		end&lt;br /&gt;
		if ( qNotLaterThan ) then&lt;br /&gt;
			table.insert( results, 'не&amp;amp;nbsp;позднее&amp;amp;nbsp;' .. formatDateImpl( qNotLaterThan.value, {}, nil, nil ) );&lt;br /&gt;
		end&lt;br /&gt;
	    return mw.text.listToText( results, ' и ' , ' и ' ) .. categoryUnknownBirthDate;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    options['conjunction'] = '&amp;amp;#32;или&amp;amp;#32;';&lt;br /&gt;
    options['value-module'] = 'Wikidata/date';&lt;br /&gt;
    options['value-function'] = 'formatBirthDate';&lt;br /&gt;
    options.i18n.somevalue = '\'\'неизвестно\'\'' .. categoryUnknownBirthDate;&lt;br /&gt;
	local result = context.formatStatementDefault( context, options, statement );&lt;br /&gt;
&lt;br /&gt;
	local bTable = { parseClaim( statement ) };&lt;br /&gt;
	local dTable = parseProperty ( context, options, 'P570' )&lt;br /&gt;
&lt;br /&gt;
	if ( bTable and not dTable ) then&lt;br /&gt;
		local age = ageCurrent( bTable )&lt;br /&gt;
		if ( age ) then&lt;br /&gt;
			if ( brcs ~= 1 ) then&lt;br /&gt;
				result = result .. ' &amp;lt;span style=&amp;quot;white-space:nowrap;&amp;quot;&amp;gt;(' .. age .. ' ' .. mw.language.new( 'ru' ):plural( age, 'год', 'года', 'лет') .. ')&amp;lt;/span&amp;gt;'&lt;br /&gt;
			end&lt;br /&gt;
			if ( not options.nocat ) then&lt;br /&gt;
				if ( age &amp;gt; 115 ) then&lt;br /&gt;
					result = result .. categoryBigCurrentAge;&lt;br /&gt;
				else&lt;br /&gt;
					result = result .. categoryBiographiesOfLivingPersons;&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return result;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.formatDateOfDeathClaimX( context, options, statement )&lt;br /&gt;
	brcs = 1&lt;br /&gt;
	return p.formatDateOfDeathClaim( context, options, statement )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.formatDateOfDeathClaim( context, options, statement )&lt;br /&gt;
	if ( not context ) then error( 'context not specified'); end;&lt;br /&gt;
	if ( not options ) then error( 'options not specified'); end;&lt;br /&gt;
	if ( not options.entity ) then error( 'options.entity is missing'); end;&lt;br /&gt;
	if ( not statement ) then error( 'statement not specified'); end;&lt;br /&gt;
	if options.nocat then categoryUnknownDeathDate = &amp;quot;&amp;quot; end&lt;br /&gt;
	&lt;br /&gt;
	local qNotSoonerThan = getQualifierDataValue( statement, 'P1319' );&lt;br /&gt;
	local qNotLaterThan = getQualifierDataValue( statement, 'P1326' );&lt;br /&gt;
	if ( qNotSoonerThan or qNotLaterThan ) then&lt;br /&gt;
		local results = {};&lt;br /&gt;
		if ( qNotSoonerThan ) then&lt;br /&gt;
			table.insert( results, 'не&amp;amp;nbsp;ранее&amp;amp;nbsp;' .. formatDateImpl( qNotSoonerThan.value, {}, nil, nil ) );&lt;br /&gt;
		end&lt;br /&gt;
		if ( qNotLaterThan ) then&lt;br /&gt;
			table.insert( results, 'не&amp;amp;nbsp;позднее&amp;amp;nbsp;' .. formatDateImpl( qNotLaterThan.value, {}, nil, nil ) );&lt;br /&gt;
		end&lt;br /&gt;
	    return mw.text.listToText( results, ' и ' , ' и ' ) .. categoryUnknownDeathDate;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    options['conjunction'] = '&amp;amp;#32;или&amp;amp;#32;';&lt;br /&gt;
    options['value-module'] = 'Wikidata/date';&lt;br /&gt;
    options['value-function'] = 'formatDeathDate';&lt;br /&gt;
    options.i18n.somevalue = '\'\'неизвестно\'\'' .. categoryUnknownDeathDate;&lt;br /&gt;
	local result = context.formatStatementDefault( context, options, statement );&lt;br /&gt;
&lt;br /&gt;
	local bTable = parseProperty ( context, options, 'P569' )&lt;br /&gt;
	local dTable = { parseClaim( statement ) };&lt;br /&gt;
&lt;br /&gt;
	if ( bTable and dTable ) then&lt;br /&gt;
		local age = age( bTable, dTable )&lt;br /&gt;
		if ( age ) then&lt;br /&gt;
			if ( brcs ~= 1 ) then&lt;br /&gt;
				result = result .. ' &amp;lt;span style=&amp;quot;white-space:nowrap;&amp;quot;&amp;gt;(' .. age .. ' ' .. mw.language.new( 'ru' ):plural( age, 'год', 'года', 'лет') .. ')&amp;lt;/span&amp;gt;'&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- returns category to recently deceased persons&lt;br /&gt;
		local unixAvailable, unixDateOfDeath = pcall(function()&lt;br /&gt;
			local r = os.time(dTable[1].structure)&lt;br /&gt;
			if ( r ~= os.time() ) then&lt;br /&gt;
				return r&lt;br /&gt;
			end&lt;br /&gt;
			error()&lt;br /&gt;
		end)&lt;br /&gt;
		if ( unixAvailable and os.time() - unixDateOfDeath &amp;lt; 31536000 and not options.nocat ) then&lt;br /&gt;
			result = result .. categoryRecentlyDeceased&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return result;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Reentry point for Wikidata Snak formatting&lt;br /&gt;
function p.formatBirthDate( context, options, value )&lt;br /&gt;
	if ( not context ) then error( 'context not specified'); end;&lt;br /&gt;
	if ( not options ) then error( 'options not specified'); end;&lt;br /&gt;
	if ( not value ) then error( 'value not specified'); end;&lt;br /&gt;
	&lt;br /&gt;
	if ( options.nocat ) then&lt;br /&gt;
		return formatDateImpl( value, options, 'bday', nil )&lt;br /&gt;
	else&lt;br /&gt;
		return formatDateImpl( value, options, 'bday', 'Родившиеся' )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Reentry point for Wikidata Snak formatting&lt;br /&gt;
function p.formatDeathDate( context, options, value )&lt;br /&gt;
	if ( not context ) then error( 'context not specified'); end;&lt;br /&gt;
	if ( not options ) then error( 'options not specified'); end;&lt;br /&gt;
	if ( not value ) then error( 'value not specified'); end;&lt;br /&gt;
&lt;br /&gt;
	if ( options.nocat and options.nocat ~= '' ) then&lt;br /&gt;
		return formatDateImpl( value, options, 'dday', nil )&lt;br /&gt;
	else&lt;br /&gt;
		return formatDateImpl( value, options, 'dday', 'Умершие' )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Reentry point for Wikidata Snak formatting -- default one&lt;br /&gt;
function p.formatDate( context, options, value )&lt;br /&gt;
	if ( not context ) then error( 'context not specified'); end;&lt;br /&gt;
	if ( not options ) then error( 'options not specified'); end;&lt;br /&gt;
	if ( not value ) then error( 'value not specified'); end;&lt;br /&gt;
&lt;br /&gt;
	local microformatClass = options.microformat or nil;&lt;br /&gt;
	if ( options.nocat and options.nocat ~= '' ) then&lt;br /&gt;
		return formatDateImpl( value, options, microformatClass, nil )&lt;br /&gt;
	else&lt;br /&gt;
		local categoryPrefix = options.categoryPrefix or nil;&lt;br /&gt;
		return formatDateImpl( value, options, microformatClass, categoryPrefix )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.formatDateIntervalProperty( context, options )&lt;br /&gt;
	if ( not context ) then error( 'context not specified' ); end;&lt;br /&gt;
	if ( not options ) then error( 'options not specified' ); end;&lt;br /&gt;
	if ( not options.entity ) then error( 'options.entity missing' ); end;&lt;br /&gt;
&lt;br /&gt;
	-- Получение нужных утверждений&lt;br /&gt;
	local WDS = require( 'Module:WikidataSelectors' );&lt;br /&gt;
	local fromProperty = options.property&lt;br /&gt;
	if options.from and options.from ~= '' then&lt;br /&gt;
		fromProperty = options.from&lt;br /&gt;
	end&lt;br /&gt;
	local fromClaims = WDS.filter( options.entity.claims, fromProperty );&lt;br /&gt;
	local toClaims = WDS.filter( options.entity.claims, options.to );&lt;br /&gt;
	local withinClaims = WDS.filter( options.entity.claims, options.within );&lt;br /&gt;
&lt;br /&gt;
    if fromClaims == nil and toClaims == nil then&lt;br /&gt;
        return ''&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local formattedFromClaims = {}&lt;br /&gt;
    if fromClaims then&lt;br /&gt;
	    for i, claim in ipairs( fromClaims ) do&lt;br /&gt;
	        local formattedStatement = context.formatStatement( options, claim )&lt;br /&gt;
	        if formattedStatement then&lt;br /&gt;
	            formattedStatement = '&amp;lt;span class=&amp;quot;wikidata-claim&amp;quot; data-wikidata-property-id=&amp;quot;' .. string.upper( options.property ) .. '&amp;quot; data-wikidata-claim-id=&amp;quot;' .. claim.id .. '&amp;quot;&amp;gt;' .. formattedStatement .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
	            table.insert( formattedFromClaims, formattedStatement )&lt;br /&gt;
	        end&lt;br /&gt;
	    end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local formattedToClaims = {}&lt;br /&gt;
    local toOptions = deepcopy( options )&lt;br /&gt;
    toOptions.property = options.to&lt;br /&gt;
    toOptions.novalue = nowLabel&lt;br /&gt;
    if toClaims then&lt;br /&gt;
	    for i, claim in ipairs( toClaims ) do&lt;br /&gt;
	        local formattedStatement = context.formatStatement( toOptions, claim )&lt;br /&gt;
	        if formattedStatement then&lt;br /&gt;
	            formattedStatement = '&amp;lt;span class=&amp;quot;wikidata-claim&amp;quot; data-wikidata-property-id=&amp;quot;' .. string.upper( toOptions.property ) .. '&amp;quot; data-wikidata-claim-id=&amp;quot;' .. claim.id .. '&amp;quot;&amp;gt;' .. formattedStatement .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
	            table.insert( formattedToClaims, formattedStatement )&lt;br /&gt;
	        end&lt;br /&gt;
	    end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
	local out = ''&lt;br /&gt;
    local fromOut = mw.text.listToText( formattedFromClaims, options.separator, options.conjunction )&lt;br /&gt;
    local toOut = mw.text.listToText( formattedToClaims, options.separator, options.conjunction )&lt;br /&gt;
    &lt;br /&gt;
	if fromOut ~= '' or toOut ~= '' then&lt;br /&gt;
	    if fromOut ~= '' then&lt;br /&gt;
	    	out = fromOut&lt;br /&gt;
		else&lt;br /&gt;
			out = '?'&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if toOut ~= '' then&lt;br /&gt;
			out = out .. ' — ' .. toOut&lt;br /&gt;
		else&lt;br /&gt;
			if withinClaims ~= nil then&lt;br /&gt;
				out = 'с ' .. out&lt;br /&gt;
			else&lt;br /&gt;
				out = out .. ' — ' .. nowLabel&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    if out ~= '' then&lt;br /&gt;
	    if options.before then&lt;br /&gt;
	    	out = options.before .. out&lt;br /&gt;
		end&lt;br /&gt;
	    if options.after then&lt;br /&gt;
	    	out = out .. options.after&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    return out&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local lowestBoundary = parseISO8601('-900-02-20T00:00:00Z')&lt;br /&gt;
local mainBoundary = parseISO8601('1582-10-05T00:00:00Z')&lt;br /&gt;
local lastBoundary = parseISO8601('1918-01-31T00:00:00Z');&lt;br /&gt;
&lt;br /&gt;
local boundaries = {&lt;br /&gt;
	-- from (G) till next will be diff(G = J + diff), at current&lt;br /&gt;
	{ lowestBoundary,                       -9 },&lt;br /&gt;
	{ parseISO8601('-700-02-29T00:00:00Z'), -8 },&lt;br /&gt;
	{ parseISO8601('-600-02-29T00:00:00Z'), -7 },&lt;br /&gt;
	{ parseISO8601('-500-02-29T00:00:00Z'), -6 },&lt;br /&gt;
	{ parseISO8601('-300-02-29T00:00:00Z'), -5 },&lt;br /&gt;
	{ parseISO8601('-200-02-29T00:00:00Z'), -4 },&lt;br /&gt;
	{ parseISO8601('-100-02-29T00:00:00Z'), -3 },&lt;br /&gt;
	{ parseISO8601('0000-00-00T00:00:00Z'), -2 },&lt;br /&gt;
	{ parseISO8601('0100-02-29T00:00:00Z'), -1 },&lt;br /&gt;
	{ parseISO8601('0200-02-29T00:00:00Z'),  0 },&lt;br /&gt;
	{ parseISO8601('0300-02-29T00:00:00Z'),  1 },&lt;br /&gt;
	{ parseISO8601('0500-02-29T00:00:00Z'),  2 },&lt;br /&gt;
	{ parseISO8601('0600-02-29T00:00:00Z'),  3 },&lt;br /&gt;
	{ parseISO8601('0700-02-29T00:00:00Z'),  4 },&lt;br /&gt;
	{ parseISO8601('0900-02-29T00:00:00Z'),  5 },&lt;br /&gt;
	{ parseISO8601('1000-02-29T00:00:00Z'),  6 },&lt;br /&gt;
	{ parseISO8601('1100-02-29T00:00:00Z'),  7 },&lt;br /&gt;
	{ parseISO8601('1300-02-29T00:00:00Z'),  8 },&lt;br /&gt;
	{ parseISO8601('1400-02-29T00:00:00Z'),  9 },&lt;br /&gt;
	{ parseISO8601('1500-02-29T00:00:00Z'), 10 },&lt;br /&gt;
	{ parseISO8601('1700-02-29T00:00:00Z'), 11 },&lt;br /&gt;
	{ parseISO8601('1800-02-29T00:00:00Z'), 12 },&lt;br /&gt;
	{ parseISO8601('1900-02-29T00:00:00Z'), 13 },&lt;br /&gt;
	{ lastBoundary, '' },&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
-- Передаваемое время обязано быть по Юлианскому календарю (старому стилю)&lt;br /&gt;
function p.formatAsJulian( julTime, infocardClass, categoryNamePrefix )&lt;br /&gt;
	if 'table' == type( julTime ) then&lt;br /&gt;
		if julTime.args and julTime.args[1] then&lt;br /&gt;
			julTime = tonumber( julTime.args[1] )&lt;br /&gt;
		else&lt;br /&gt;
			return 'unknown argument type: ' .. type( julTime ) .. ': ' .. table.tostring( julTime )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local t = os.date( &amp;quot;*t&amp;quot;, julTime )&lt;br /&gt;
	if ( julTime &amp;lt;= lowestBoundary ) then&lt;br /&gt;
		return &amp;quot;''некорректная дата (недостижимая точность)''&amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
	if ( julTime &amp;gt;= lastBoundary ) then&lt;br /&gt;
		return &amp;quot;''некорректная дата (юлианский не используется после 1918-01-26)''&amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    for i=1,#boundaries,1 do&lt;br /&gt;
		local b1 = boundaries[i][1];&lt;br /&gt;
		local b2 = boundaries[i + 1][1];&lt;br /&gt;
		if ( b1 &amp;lt;= julTime and julTime &amp;lt; b2 ) then&lt;br /&gt;
			local b1s = os.date( &amp;quot;*t&amp;quot;, b1 )&lt;br /&gt;
			if ( b1s.year == t.year and b1s.month == t.month and b1s.day == t.day) then&lt;br /&gt;
				if ( julTime &amp;lt; mainBoundary ) then&lt;br /&gt;
					-- only julian&lt;br /&gt;
					return moduleDates.formatWikiImpl( {year=t.year, month=2, day=29}, {year=t.year, month=2, day=29}, infocardClass, categoryNamePrefix );&lt;br /&gt;
				else&lt;br /&gt;
					--julian and grigorian&lt;br /&gt;
					return moduleDates.formatWikiImpl( {year=t.year, month=2, day=29}, t, infocardClass, categoryNamePrefix, brcs )&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				local gregTime = os.date( &amp;quot;*t&amp;quot;, julTime + boundaries[i][2] * 24 * 60 * 60 );&lt;br /&gt;
				if ( julTime &amp;lt; mainBoundary ) then&lt;br /&gt;
					-- only julian&lt;br /&gt;
					return moduleDates.formatWikiImpl( t, t, infocardClass, categoryNamePrefix );&lt;br /&gt;
				else&lt;br /&gt;
					--julian and grigorian&lt;br /&gt;
					return moduleDates.formatWikiImpl( t, gregTime, infocardClass, categoryNamePrefix, brcs )&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    if ( julTime &amp;gt;= lastBoundary ) then&lt;br /&gt;
		return &amp;quot;''ошибка в модуле Модуль:Wikidata/date (не найден сдвиг конвертации календаря)''&amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>wiki&gt;Carn</name></author>
	</entry>
</feed>