View source for Module:Citation/CS1/Date validation
You do not have permission to edit this page, for the following reason:
You can view and copy the source of this page.
local p = {}
-- returns a number according to the month in a date: 1 for January, etc. Capitalization and spelling must be correct. If not a valid month, returns 0
function get_month_number (month)
local long_months = {['January']=1, ['February']=2, ['March']=3, ['April']=4, ['May']=5, ['June']=6, ['July']=7, ['August']=8, ['September']=9, ['October']=10, ['November']=11, ['December']=12};
local short_months = {['Jan']=1, ['Feb']=2, ['Mar']=3, ['Apr']=4, ['May']=5, ['Jun']=6, ['Jul']=7, ['Aug']=8, ['Sep']=9, ['Oct']=10, ['Nov']=11, ['Dec']=12};
local temp;
temp=long_months[month];
if temp then return temp; end -- if month is the long-form name
temp=short_months[month];
if temp then return temp; end -- if month is the short-form name
return 0; -- misspelled, improper case, or not a month name
end
-- returns a number according to the sequence of seasons in a year: 1 for Winter, etc. Capitalization and spelling must be correct. If not a valid season, returns 0
function get_season_number (season)
local season_list = {['Winter']=1, ['Spring']=2, ['Summer']=3, ['Fall']=4, ['Autumn']=4}
local temp;
temp=season_list[season];
if temp then return temp; end -- if season is a valid name return its number
000
1:0
Templates used on this page:
- Template:High-risk (view source)
- Template:Ombox (view source)
- Module:Arguments (view source)
- Module:Category handler (view source)
- Module:Category handler/blacklist (view source)
- Module:Category handler/config (view source)
- Module:Category handler/data (view source)
- Module:Category handler/shared (view source)
- Module:Citation/CS1/Date validation/doc (view source)
- Module:HtmlBuilder (view source)
- Module:Message box (view source)
- Module:Message box/configuration (view source)
- Module:Namespace detect/config (view source)
- Module:Namespace detect/data (view source)
- Module:Yesno (view source)
Return to Module:Citation/CS1/Date validation.