"ഘടകം:Citation/CS1/Date validation" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
Content deleted Content added
Jacob.jose (സംവാദം | സംഭാവനകൾ) Updating again to test |
finally? |
||
(ഒരേ ഉപയോക്താവ് ചെയ്ത ഇടയ്ക്കുള്ള 3 നാൾപ്പതിപ്പുകൾ പ്രദർശിപ്പിക്കുന്നില്ല) | |||
വരി 363:
local function check_date (date_string, tCOinS_date, test_accessdate)
local year; -- assume that year2, months, and days are not used;
local year2=0; -- second year in a year range
Line 371 ⟶ 372:
local anchor_year;
local coins_date;
if date_string:match("^%d%d%d%d%-%d%d%-%d%d$") then -- year-initial numerical year month day format
year, month, day=string.match(date_string, "(%d%d%d%d)%-(%d%d)%-(%d%d)");
Line 391 ⟶ 392:
elseif mw.ustring.match(date_string, "^[1-9]%d? +%D- +[1-9]%d%d%d%a?$") then -- day-initial: day month year
day, month, anchor_year, year=mw.ustring.match(date_string, "(%d%d*)%s*(%D-) +((%d%d%d%d?)%a?)");
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
elseif mw.ustring.match(date_string, "^[1-9]%d%d%d +%D- +[1-9]%d?$") then -- day-initial: year month day
year, month, day=mw.ustring.match(date_string, "(%d%d%d%d?) +(%D-) +(%d%d*)");
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
Line 675 ⟶ 681:
['mdy'] = '^(%a+)%s+(%d%d?),%s+(%d%d%d%d)$',
['ymd'] = '^(%d%d%d%d)%-(%d%d)-(%d%d)$',
['ymd2'] = '^(%d%d%d%d)%s+(%a+)%s+(%d%d)$',
}
Line 681 ⟶ 688:
['mdy'] = '%b %e, %Y',
['ymd'] = '%F',
['ymd2'] = '%Y %b %e',
}
Line 687 ⟶ 695:
['mdy'] = '%B %e, %Y',
['ymd'] = '%F',
['ymd2'] = '%Y %B %e',
}
Line 722 ⟶ 731:
local function get_ymd_date_parts (date, source_date)
source_date.year, source_date.month, source_date.day = date:match (source_patterns['ymd']); -- get date components as strings
end
--[[-------------------------< G E T _ Y M D2 _ D A T E _ P A R T S >------------------------------------------
extracts year, month and day from YMD formatted date, places them in the source_date table, and returns.
]]
local function get_ymd2_date_parts (date, source_date)
source_date.year, source_date.month, source_date.day = date:match (source_patterns['ymd2']); -- get date components as strings
end
Line 760 ⟶ 780:
if 'ymd' == source then
get_ymd_date_parts (param_val.val, source_date); -- get the date parts into the source_date table
elseif 'ymd2' == source then
get_ymd2_date_parts (param_val.val, source_date); -- get the date parts into the source_date table
elseif 'dmy' == source then
get_dmy_date_parts (param_val.val, source_date); -- get the date parts into the source_date table
|