Welcome to EverybodyWiki 😃 ! Nuvola apps kgpg.png Log in or ➕👤 create an account to improve, watchlist or create an article like a 🏭 company page or a 👨👩 bio (yours ?)...

پودمان:Iranian calendar

از EverybodyWiki Bios & Wiki
پرش به:ناوبری، جستجو
صفحه الگو:Ombox/styles.css محتوایی ندارد.


{{#invoke:Iranian calendar|function_name}}

-- This module is under development.

-- Useful functions about Iranian calendar to be used in Persian Wikipedia
-- Written by Alireza Eskandarpour Shoferi (@AEsShoferi) in Lua
-- Distributed under the terms of the CC BY-SA 4.0

-- Load necessary modules
local library = require("Module:Iranian calendar/library")
local convertToFa = require("Module:Numeral converter").convert
local getArgs = require("Module:Arguments").getArgs

local p = {}

function p.Age(frame)
	local args = getArgs(frame, {trim=true, removeBlanks=true})
	-- Converts Persian numbers to English because of arithmetic expressions
	local firstSet = {year = tonumber(convertToFa("en",args[1])), month = tonumber(convertToFa("en",args[2])), day = tonumber(convertToFa("en",args[3]))}
	local secondSet = {year = tonumber(convertToFa("en",args[4])) or library.getCurrentJalaliYear(), month = tonumber(convertToFa("en",args[5])) or library.getCurrentJalaliMonth(), day = tonumber(convertToFa("en",args[6])) or library.getCurrentJalaliDay()}

	-- Following expression borrowed from [[:en:Template:Age]]
	return convertToFa("fa",(secondSet.year - firstSet.year) - (((tonumber(secondSet.month) < tonumber(firstSet.month) ) or secondSet.month == firstSet.month and tonumber(secondSet.day) < tonumber(firstSet.day) ) and 1 or 0) )

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.