Документация

Примеры вызова функции dateOfBirth

  • {{#invoke:Infocards|dateOfBirth|-382|−336}} → 382 до н. э.(-382)
  • {{#invoke:Infocards|dateOfBirth|11.1|}} → 11 января
  • {{#invoke:Infocards|dateOfBirth|24.12.3|15.01.69}} → 24 декабря 3(0003-12-24)
  • {{#invoke:Infocards|dateOfBirth|23.09.-63|19.08.14}} → 23 сентября 63 до н. э.(-063-09-23)
  • {{#invoke:Infocards|dateOfBirth|42|9.6.42}} → 42(0042)
  • {{#invoke:Infocards|dateOfBirth|870|13.8.900}} → 870(0870)
  • {{#invoke:Infocards|dateOfBirth||22.01.984}} →
  • {{#invoke:Infocards|dateOfBirth|16.06.1066|дата смерти неизвестна}} → 16 июня 1066(1066-06-16)
  • {{#invoke:Infocards|dateOfBirth|8.2.1834 (27.1)|2.2.1907 (20.1)}} → 27 января (8 февраля) 1834(1834-02-08)
  • {{#invoke:Infocards|dateOfBirth|29.06.1844 (17)|28.10.1883 (16)}} → 17 (29) июня 1844(1844-06-29)
  • {{#invoke:Infocards|dateOfBirth|19.7.1893 (7)|}} → 7 (19) июля 1893(1893-07-19)
  • {{#invoke:Infocards|dateOfBirth|3.10.1895 (21.9)|28.12.1925}} → 21 сентября (3 октября) 1895(1895-10-03)
  • {{#invoke:Infocards|dateOfBirth|4.10.1916|8.11.2009}} → 4 октября 1916(1916-10-04)
  • {{#invoke:Infocards|dateOfBirth|09.06.1942|}} → 9 июня 1942(1942-06-09) (82 года)
  • {{#invoke:Infocards|dateOfBirth|1955|}} → 1955(1955)
  • {{#invoke:Infocards|dateOfBirth|29.02.1984|}} → 29 февраля 1984(1984-02-29) (40 лет)
  • {{#invoke:Infocards|dateOfBirth||}} →
  • {{#invoke:Infocards|dateOfBirth|4.1.1885 (23.12.1884)|17.5.1951}} → 23 декабря 1884 (4 января 1885)(1885-01-04)
  • {{#invoke:Infocards|dateOfBirth|{{ДатаРождения|24|12|3}}|{{ДатаСмерти|15|01|69}}}} → 24 декабря 3
  • {{#invoke:Infocards|dateOfBirth|ок. [[5]] года|24.01.41}} → ок. 5 года
  • {{#invoke:Infocards|dateOfBirth|ок. [[5]] года|{{ДатаСмерти|24|01|41}}}} → ок. 5 года
  • {{#invoke:Infocards|dateOfBirth|[[868]]/[[872]]|[[15 сентября]]/[[15 ноября]] [[890]]}} → 868/872
  • {{#invoke:Infocards|dateOfBirth|{{ДатаРождения|8|2|1834|27|1}}|{{ДатаСмерти|2|2|1907|20|1}} (72 года)}} → 27 января (8 февраля) 1834

Примеры вызова функции dateOfDeath

  • {{#invoke:Infocards|dateOfDeath|-382|−336}} → 336 до н. э.(-336)
  • {{#invoke:Infocards|dateOfDeath|24.12.3|15.01.69}} → 15 января 69(0069-01-15) (65 лет)
  • {{#invoke:Infocards|dateOfDeath|23.09.-63|19.08.14}} → 19 августа 14(0014-08-19) (76 лет)
  • {{#invoke:Infocards|dateOfDeath|42|9.6.42}} → 9 июня 42(0042-06-09)
  • {{#invoke:Infocards|dateOfDeath|870|13.8.900}} → 13 августа 900(0900-08-13)
  • {{#invoke:Infocards|dateOfDeath||22.01.984}} → 22 января 984(0984-01-22)
  • {{#invoke:Infocards|dateOfDeath|16.06.1066|дата смерти неизвестна}} → дата смерти неизвестна
  • {{#invoke:Infocards|dateOfDeath|8.2.1834 (27.1)|2.2.1907 (20.1)}} → 20 января (2 февраля) 1907(1907-02-02) (72 года)
  • {{#invoke:Infocards|dateOfDeath|29.06.1844 (17)|28.10.1883 (16)}} → 16 (28) октября 1883(1883-10-28) (39 лет)
  • {{#invoke:Infocards|dateOfDeath|19.7.1893 (7)|}} → 14 апреля 1930(1930-04-14) (36 лет)
  • {{#invoke:Infocards|dateOfDeath|3.10.1895 (21.9)|28.12.1925}} → 28 декабря 1925(1925-12-28) (30 лет)
  • {{#invoke:Infocards|dateOfDeath|4.10.1916|8.11.2009}} → 8 ноября 2009(2009-11-08) (93 года)
  • {{#invoke:Infocards|dateOfDeath|09.06.1942|}} →
  • {{#invoke:Infocards|dateOfDeath|1955|}} →
  • {{#invoke:Infocards|dateOfDeath|29.02.1984|}} →
  • {{#invoke:Infocards|dateOfDeath||}} →
  • {{#invoke:Infocards|dateOfDeath|{{ДатаРождения|24|12|3}}|{{ДатаСмерти|15|01|69}}}} → 15 января 69
  • {{#invoke:Infocards|dateOfDeath|ок. [[5]] года|24.01.41}} → 24 января 41(0041-01-24)
  • {{#invoke:Infocards|dateOfDeath|ок. [[5]] года|{{ДатаСмерти|24|01|41}}}} → 24 января 41
  • {{#invoke:Infocards|dateOfDeath|[[868]]/[[872]]|[[15 сентября]]/[[15 ноября]] [[890]]}} → 15 сентября/15 ноября 890
  • {{#invoke:Infocards|dateOfDeath|{{ДатаРождения|8|2|1834|27|1}}|{{ДатаСмерти|2|2|1907|20|1}} (72 года)}} → 20 января (2 февраля) 1907 (72 года)

Примеры вызова функции isDate

  • {{#invoke:Infocards|isDate||TRUE|FALSE}} → FALSE
  • {{#invoke:Infocards|isDate|-382|TRUE|FALSE}} → TRUE
  • {{#invoke:Infocards|isDate|−336|TRUE|FALSE}} → TRUE
  • {{#invoke:Infocards|isDate|24.12.3|TRUE|FALSE}} → TRUE
  • {{#invoke:Infocards|isDate|19.7.1893 (7)|TRUE|FALSE}} → TRUE
  • {{#invoke:Infocards|isDate|19.7.67.18/93 (7)|TRUE|FALSE}} → FALSE
  • {{#invoke:Infocards|isDate|13 декабря 2005|TRUE|FALSE}} → FALSE
  • {{#invoke:Infocards|isDate|дата смерти неизвестна|TRUE|FALSE}} → FALSE
  • {{#invoke:Infocards|isDate|{{ДатаРождения|24|12|3}}|TRUE|FALSE}} → FALSE
local infocards = {}local calculateAge = truelocal dateCat = require( 'Module:Infocards/dateCat' )local moduleDates = require( 'Module:Dates' )--[[Helper function that populates the argument list given that user may need to use a mix ofnamed and unnamed parameters.  This is relevant because named parameters are notidentical to unnamed parameters due to string trimming, and when dealing with stringswe sometimes want to either preserve or remove that whitespace depending on the application.]]function infocards._getParameters( frame_args, arg_list )local new_args = {}local index = 1local value for i,arg in ipairs( arg_list ) dovalue = frame_args[arg]if value == nil thenvalue = frame_args[index]index = index + 1endnew_args[arg] = valueend return new_argsend        function infocards.isBlank( someString )return someString == nil or mw.ustring.match(someString, '^%s*$') ~= nilendfunction infocards.isDate ( frame )local new_args = infocards._getParameters( frame.args, {'s', 't', 'f'} )local s = new_args['s'] or ''local t = new_args['t'] or ''local f = new_args['f'] or ''local result = infocards.isDateImpl ( s )if (result) thenreturn telsereturn fendendfunction infocards.isDateImpl ( s )local converted = infocards.convertToDate ( s )return converted ~= nilendfunction infocards.dateOfBirth( frame )local new_args = infocards._getParameters( frame.args, {'dateOfBirth', 'dateOfDeath', 'suppressAge', 'nocat'} )local dateOfBirth = new_args['dateOfBirth'] or ''local dateOfDeath = new_args['dateOfDeath'] or ''local suppressAge = new_args['suppressAge'] or ''local nocat = new_args['nocat'] or mw.title.getCurrentTitle().nsTextreturn infocards.dateOfBirthImpl( dateOfBirth, dateOfDeath, suppressAge, nocat )endfunction infocards.dateOfBirthImpl( dateOfBirth, dateOfDeath, suppressAge, nocat )local appendToCategory = infocards.isBlank( nocat )if ( infocards.isBlank( dateOfBirth ) ) thenif ( appendToCategory ) thenreturn dateCat.categoryNoBirthDateelsereturn ''endendif ( mw.ustring.match( dateOfBirth, '^%s*неизвестн.%s*$' ) ~= nilor mw.ustring.match( dateOfBirth, '^%s*%?%s*$' ) ~= nil ) thenif ( appendToCategory ) thenreturn "''неизвестно''" .. dateCat.categoryUnknownBirthDateelsereturn "''неизвестно''"endendlocal appendAge = not (suppressAge ~= '' or not calculateAge) and infocards.isBlank( dateOfDeath )local parsedDate = infocards.convertToDate ( dateOfBirth )if ( parsedDate == nil ) then--[[ Temporary hack in order to enable export dates to wikidata ]]local bDateStart = '<span class="no-wikidata" data-wikidata-property-id="P569">'local bDateEnd = '</span>'if ( appendToCategory ) thenreturn bDateStart .. dateOfBirth .. bDateEnd .. dateCat.categoryManualWikificationelsereturn bDateStart .. dateOfBirth .. bDateEndendendlocal result = infocards.formatDateImpl ( parsedDate, 'bday', appendToCategory and 'Родившиеся' or nil )if ( appendAge ) then-- TODO: месяцы и дни для (нескольких) новорождённых (см. новейшие [[Категория:Родившиеся в ГГГГ году]])local age = infocards.age ( parsedDate,  os.date("*t") )if ( age and age < 125) thenresult = result .. ' <span class="nowrap">(' .. age .. ' ' .. mw.language.new( 'ru' ):plural( age, 'год', 'года', 'лет') .. ')</span>'endif ( appendToCategory ) thenif (not age and parsedDate and parsedDate.year ) thenage = os.date('*t').year - parsedDate.year -- при неточной дате endif ( age ) then if ( age > 115 ) thenresult = result .. dateCat.categoryBigCurrentAgeelseif ( age >= 0 ) then result = result .. dateCat.categoryBiographiesOfLivingPersonselseresult = result .. dateCat.categoryNegativeAgeendendendendreturn resultendfunction infocards.dateOfDeath( frame )local new_args = infocards._getParameters( frame.args, {'dateOfBirth', 'dateOfDeath', 'nocat'} )local dateOfBirth = new_args['dateOfBirth'] or ''local dateOfDeath = new_args['dateOfDeath'] or ''local nocat = new_args['nocat'] or mw.title.getCurrentTitle().nsTextreturn infocards.dateOfDeathImpl( dateOfBirth, dateOfDeath, nocat )endfunction infocards.dateOfDeathImpl( dateOfBirth, dateOfDeath, nocat )if ( infocards.isBlank( dateOfDeath ) ) thenreturn ''endlocal appendToCategory = infocards.isBlank( nocat )if ( mw.ustring.match( dateOfDeath, '^%s*неизвестн.%s*$' ) ~= nilor mw.ustring.match( dateOfDeath, '^%s*%?%s*$' ) ~= nil ) thenif ( appendToCategory ) thenreturn "''неизвестно''" .. dateCat.categoryUnknownDeathDateelsereturn "''неизвестно''"endendlocal parsedDateOfBirth = infocards.convertToDate ( dateOfBirth )local parsedDateOfDeath = infocards.convertToDate ( dateOfDeath )if ( parsedDateOfDeath == nil ) then--[[ Temporary hack in order to enable export dates to wikidata ]]local dDateStart = '<span class="no-wikidata" data-wikidata-property-id="P570">'local dDateEnd = '</span>'if ( appendToCategory ) thenreturn dDateStart .. dateOfDeath .. dDateEnd .. dateCat.categoryManualWikificationelsereturn dDateStart .. dateOfDeath .. dDateEndendendlocal result = infocards.formatDateImpl ( parsedDateOfDeath, 'dday', appendToCategory and 'Умершие' or nil )if ( calculateAge ) thenlocal age = infocards.age ( parsedDateOfBirth, parsedDateOfDeath )if ( age and age > 0 ) thenresult = result .. ' <span class="nowrap">(' .. age .. ' ' .. mw.language.new( 'ru' ):plural( age, 'год', 'года', 'лет') .. ')</span>'end-- returns category to recently deceased personslocal unixAvailable, unixDateOfDeath = pcall(function()local r = os.time(parsedDateOfDeath)if ( r ~= os.time() ) thenreturn renderror()end)if (appendToCategory) thenif ( unixAvailable and os.time() - unixDateOfDeath < 31536000 ) thenresult = result .. dateCat.categoryRecentlyDeceasedelseif (age and age < 0) thenresult = result .. dateCat.categoryNegativeAgeendendendreturn resultendfunction infocards.age( parsedBirthDate, parsedFinishDate ) if ( parsedBirthDate == nil or parsedFinishDate == nil ) thenreturn nilendlocal bd = parsedBirthDate["day"]local bm = parsedBirthDate["month"]local by = parsedBirthDate["year"]local dd = parsedFinishDate["day"]local dm = parsedFinishDate["month"]local dy = parsedFinishDate["year"]if ( bd and bm and by and dd and dm and dy ) thenif ( dm > bm or ( dm == bm and dd >= bd ) ) thenreturn dy - byelsereturn dy - by - 1endelsereturn nilendendfunction infocards.formatDateImpl( parsedDate, infocardClass, categoryNamePrefix )local datePart = '<span class="nowrap">'--Temporary hack in order to enable export dates to wikidataif infocardClass == "bday" thendatePart = '<span class="no-wikidata" data-wikidata-property-id="P569">'elseif infocardClass == "dday" thendatePart = '<span class="no-wikidata" data-wikidata-property-id="P570">'endlocal t1 = { day = parsedDate.osday, month = parsedDate.osmonth, year = parsedDate.osyear }local t2 = { day = parsedDate.day, month = parsedDate.month, year = parsedDate.year }datePart = datePart .. moduleDates.formatWikiImpl( t1, t2, infocardClass, categoryNamePrefix )datePart = datePart .. '</span>'return datePartendfunction infocards.convertToDate( possibleDateString )possibleDateString = mw.ustring.gsub( possibleDateString, '−', '-')local simpleDate = mw.ustring.match(possibleDateString, '^%s*([%-%d%.]+)%s*$', 0)if ( simpleDate ) thenreturn infocards.convertToDateNewStylePart( simpleDate )endlocal complexDate1, complexDate2 = mw.ustring.match(possibleDateString, '^%s*([%-%d%.]+)%s*%(([%-%d%.]+)%)%s*$', 0)if ( complexDate1 and complexDate2) thenlocal table1 = infocards.convertToDateNewStylePart( complexDate1 )local table2 = infocards.convertToDateOldStylePart( complexDate2 )if ( table1 and table2 ) thenreturn {year = table1["year"], month = table1["month"], day = table1["day"], osyear = table2["year"], osmonth = table2["month"], osday = table2["day"]}elsereturn nilendendreturn nilendfunction infocards.convertToDateNewStylePart( possibleDateString )local ny = mw.ustring.match(possibleDateString, '^(%-?%d+)$', 0)if (ny ~= nil) thenreturn {year = tonumber(ny)}endreturn infocards.convertToDateCommonPart( possibleDateString )endfunction infocards.convertToDateOldStylePart( possibleDateString )local nd = mw.ustring.match(possibleDateString, '^(%-?%d+)$', 0)if (nd ~= nil) thenreturn {day = tonumber(nd)}endreturn infocards.convertToDateCommonPart( possibleDateString )endfunction infocards.convertToDateCommonPart( possibleDateString )local sDay, sMonth, sYearlocal day, month, yearsDay, sMonth, sYear = mw.ustring.match( possibleDateString, '^(%d?%d)%.(%d?%d)%.(%-?%d+)$', 0 )if sDay ~= nil and sMonth ~= nil and sYear ~= nil thenday = tonumber( sDay )month = tonumber( sMonth )year = tonumber( sYear )if day >= 1 and day <= 32 and month >= 1 and month <= 12 thenreturn { day = day, month = month, year = year }endendsDay, sMonth = mw.ustring.match( possibleDateString, '^(%d?%d)%.(%d?%d+)$', 0 )if sDay ~= nil and sMonth ~= nil thenday = tonumber( sDay )month = tonumber( sMonth )if day >= 1 and day <= 32 and month >= 1 and month <= 12 thenreturn { day = day, month = month }endendsMonth, sYear = mw.ustring.match( possibleDateString, '^(%d?%d)%.(%-?%d+)$', 0 )    if sMonth ~= nil and sYear ~= nil then    month = tonumber( sMonth )    year = tonumber( sYear )    if month >= 1 and month <= 12 then        return { month = month, year = year }        end    endreturn nilendreturn infocards
🔥 Top keywords: Заглавная страницаЯндексСлужебная:ПоискСу-57YouTubeГодовщины свадьбыЗаворотнюк, Анастасия ЮрьевнаОбодзинский, Валерий ВладимировичЗверев, АлександрКараганов, Сергей АлександровичАлькарас, КарлосВыборы в Европейский парламент (2024)Список умерших в 2024 годуЧемпионат Европы по футболу 2024РоссияПопков, Михаил ВикторовичЧернышёв, Пётр АндреевичГреф, Герман ОскаровичЧикатило, Андрей РомановичПушкин, Александр СергеевичFallout (серия игр)КлеопатраПутин, Владимир ВладимировичИмавов, Нассурдин АбдулазимовичАзбука МорзеБитва экстрасенсовРаспутин, Григорий ЕфимовичБарабаш, Юрий Владиславович9 июняМинистерство неджентльменских делВторжение России на Украину (с 2022)WildberriesСписок фильмов кинематографической вселенной MarvelTelegramХристианско-демократический союз ГерманииАльтернатива для ГерманииВКонтактеВодительское удостоверение в Российской ФедерацииЖукова, Софья Ивановна