خانه
تصادفی
ورود
تنظیمات
دربارهٔ ویکیهزاره
تکذیبنامهها
ویکیهزاره
جستجو
در حال ویرایش
پودمان:Iranian calendar
هشدار:
شما وارد نشدهاید. نشانی آیپی شما برای عموم قابل مشاهده خواهد بود اگر هر تغییری ایجاد کنید. اگر
وارد شوید
یا
یک حساب کاربری بسازید
، ویرایشهایتان به نام کاربریتان نسبت داده خواهد شد، همراه با مزایای دیگر.
بررسی ضدهرزنگاری. این قسمت را پر
نکنید
!
-- 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 convertNumber = require("Module:Numeral converter").convert local getArgs = require("Module:Arguments").getArgs -- function form [[Module:Age#L-113]] local function stripToNil(text) -- If text is a string, return its trimmed content, or nil if empty. -- Otherwise return text (which may, for example, be nil). if type(text) == 'string' then text = mw.ustring.match(text, '(%S.-)%s*$') end return text end local p = {} function p.Age(frame) local args = getArgs(frame, {trim=true, removeBlanks=true}) -- Converts Persian numbers to English because of arithmetic expressions local birthSet = {year = tonumber(convertNumber("en", args[1])), month = tonumber(convertNumber("en", args[2])), day = tonumber(convertNumber("en", args[3]))} local deathSet = {year = tonumber(convertNumber("en", args[4])) or library.getCurrentJalaliYear(), month = tonumber(convertNumber("en", args[5])) or library.getCurrentJalaliMonth(), day = tonumber(convertNumber("en", args[6])) or library.getCurrentJalaliDay()} if not stripToNil(birthSet.month) and not stripToNil(birthSet.day) then -- If day and month of birth is not provided, -- then calculate the age using only the birth-year -- In this case, month and day of the death are not considered for calculation -- outputs a range; e.g. 54–55 return convertNumber("fa", (deathSet.year - birthSet.year) - 1) .. '–' .. convertNumber("fa", (deathSet.year - birthSet.year)) else -- Following expression borrowed from [[:en:Template:Age]] return convertNumber("fa", (deathSet.year - birthSet.year) - (((tonumber(deathSet.month) < tonumber(birthSet.month) ) or deathSet.month == birthSet.month and tonumber(deathSet.day) < tonumber(birthSet.day) ) and 1 or 0) ) end end return p
خلاصه:
لطفاً توجه داشته باشید که همهٔ مشارکتها در ویکیهزاره ممکن است توسط دیگر مشارکتکنندگان تغییر یابند، ویرایش یا حذف شوند. اگر نمیخواهید نوشتههایتان بیرحمانه ویرایش شوند؛ بنابراین، آنها را اینجا ارائه نکنید.
شما همچنین به ما تعهد میکنید که خودتان این را نوشتهاید یا آن را از یک منبع با مالکیت عمومی یا مشابه آزاد آن برداشتهاید (
ویکیهزاره:حق تکثیر
را برای جزئیات بیشتر ببینید).
کارهای دارای حق تکثیر را بدون اجازه ارائه نکنید!
لغو
راهنمای ویرایش
(در پنجرهٔ تازه باز میشود)
صفحهٔ گنحاندهشده در این صفحه:
پودمان:Iranian calendar/توضیحات
(
ویرایش
)