کاربر ناشناس
اصلاح + رده نگهداری
imported>Mensis Mirabilis (انگلیسی کردن برای درستیآزمایی تاریخ) |
(اصلاح + رده نگهداری) |
||
| خط ۱: | خط ۱: | ||
local numConv = require("module:Numeral converter2").convert | local numConv = require("module:Numeral converter2").convert | ||
local p = {} | local p = {} | ||
| خط ۱۲: | خط ۱۳: | ||
returns true if: | returns true if: | ||
imamatpedia start date <= accessdate < today + 2 days | |||
imamatpedia start date is 2001-01-15T00:00:00 UTC which is 979516800 seconds after 1970-01-01T00:00:00 UTC (the start of Unix time) | |||
accessdate is the date provided in |accessdate= at time 00:00:00 UTC | accessdate is the date provided in |accessdate= at time 00:00:00 UTC | ||
today is the current date at time 00:00:00 UTC plus 48 hours | today is the current date at time 00:00:00 UTC plus 48 hours | ||
| خط ۴۳: | خط ۴۴: | ||
end | end | ||
if 979516800 <= access_ts and access_ts < tomorrow_ts then -- | if 979516800 <= access_ts and access_ts < tomorrow_ts then -- imamatpedia start date <= accessdate < tomorrow's date | ||
return true; | return true; | ||
else | else | ||
| خط ۱۶۲: | خط ۱۶۳: | ||
year_limit = tonumber(os.date("%Y"))+1; -- global variable so we only have to fetch it once | year_limit = tonumber(os.date("%Y"))+1; -- global variable so we only have to fetch it once | ||
end | end | ||
return tonumber(year) <= year_limit; -- false if year is in the future more than one year | return tonumber(year) <= year_limit; -- false if year is in the future more than one year | ||
end | end | ||
| خط ۱۷۹: | خط ۱۷۹: | ||
local days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | local days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | ||
local month_length; | local month_length; | ||
if not is_valid_year(year) then -- no farther into the future than next year | if not is_valid_year(year) then -- no farther into the future than next year | ||
return false; | return false; | ||
| خط ۶۴۳: | خط ۶۴۴: | ||
]] | ]] | ||
local function dates(date_parameters_list, tCOinS_date) | local function dates(date_parameters_list, tCOinS_date,IgnoreYear) | ||
local anchor_year; -- will return as nil if the date being tested is not |date= | local anchor_year; -- will return as nil if the date being tested is not |date= | ||
local COinS_date; -- will return as nil if the date being tested is not |date= | local COinS_date; -- will return as nil if the date being tested is not |date= | ||
| خط ۶۶۶: | خط ۶۶۷: | ||
elseif v.val:match("^nd%a?$") then -- if |date=nd with or without a CITEREF disambiguator | elseif v.val:match("^nd%a?$") then -- if |date=nd with or without a CITEREF disambiguator | ||
good_date, anchor_year, COinS_date = true, v.val:match("((nd)%a?)"); --"nd"; no error when date parameter is set to no date | good_date, anchor_year, COinS_date = true, v.val:match("((nd)%a?)"); --"nd"; no error when date parameter is set to no date | ||
else | else | ||
good_date, anchor_year, COinS_date = check_date (v.val, tCOinS_date); -- go test the date | good_date, anchor_year, COinS_date = check_date (v.val, tCOinS_date); -- go test the date | ||
| خط ۶۸۳: | خط ۶۸۵: | ||
good_date = check_date (v.val); -- go test the date | good_date = check_date (v.val); -- go test the date | ||
end | end | ||
if false==good_date then | --if is_set(IgnoreYear) then --Falocalization | ||
if in_array (IgnoreYear, cfg.keywords['yes_true_y']) then | |||
add_maint_cat('ignore_date_err') | |||
good_date = true; | |||
end | |||
if false==good_date then -- assemble one error message so we don't add the tracking category multiple times | |||
if is_set(error_message) then -- once we've added the first portion of the error message ... | if is_set(error_message) then -- once we've added the first portion of the error message ... | ||
error_message=error_message .. cfg.presentation['sep_errors']; -- ... add a comma space separator (falocalization:separator) | error_message=error_message ..IgnoreYear.. cfg.presentation['sep_errors']; -- ... add a comma space separator (falocalization:separator) | ||
end | end | ||
error_message=error_message .. "|" .. v.name .. "="; -- add the failed parameter | error_message=error_message .. "|" .. v.name .. "="; -- add the failed parameter | ||
| خط ۹۵۶: | خط ۹۶۴: | ||
is_set = utilities_page_ptr.is_set; -- import functions from selected Module:Citation/CS1/Utilities module | is_set = utilities_page_ptr.is_set; -- import functions from selected Module:Citation/CS1/Utilities module | ||
in_array = utilities_page_ptr.in_array; -- import functions from selected Module:Citation/CS1/Utilities module | in_array = utilities_page_ptr.in_array; -- import functions from selected Module:Citation/CS1/Utilities module | ||
add_maint_cat = utilities_page_ptr.add_maint_cat --Falocal-- import functions from selected Module:Citation/CS1/Utilities module | |||
cfg = cfg_table_ptr; -- import tables from selected Module:Citation/CS1/Configuration | cfg = cfg_table_ptr; -- import tables from selected Module:Citation/CS1/Configuration | ||
end | end | ||