Changes

Jump to navigation Jump to search
synch from sandbox;
Line 376: Line 376:  
if 12 < tonumber(month) or 1 > tonumber(month) or 1582 > tonumber(year) or 0 == tonumber(day) then return false; end -- month or day number not valid or not Gregorian calendar
 
if 12 < tonumber(month) or 1 > tonumber(month) or 1582 > tonumber(year) or 0 == tonumber(day) then return false; end -- month or day number not valid or not Gregorian calendar
 
anchor_year = year;
 
anchor_year = year;
elseif mw.ustring.match(date_string, "^%D- +[1-9]%d?, +[1-9]%d%d%d%a?$") then -- month-initial: month day, year
+
elseif mw.ustring.match(date_string, "^%D- +[1-9]%d?, +[1-9]%d%d%d%a?$") then -- month-initial: month day, year
 
month, day, anchor_year, year=mw.ustring.match(date_string, "(%D-) +(%d%d?),%s*((%d%d%d%d?)%a?)");
 
month, day, anchor_year, year=mw.ustring.match(date_string, "(%D-) +(%d%d?),%s*((%d%d%d%d?)%a?)");
 
month = get_month_number (month);
 
month = get_month_number (month);
 
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
 
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, "^%D- +[1-9]%d?[%-–][1-9]%d?, +[1-9]%d%d%d%a?$") then -- month-initial day range: month day–day, year; days are separated by endash
+
elseif mw.ustring.match(date_string, "^%D- +[1-9]%d?[%-–][1-9]%d?, +[1-9]%d%d%d%a?$") then -- month-initial day range: month day–day, year; days are separated by endash
 
month, day, day2, anchor_year, year=mw.ustring.match(date_string, "(%D-) +(%d%d?)[%-–](%d%d?), +((%d%d%d%d)%a?)");
 
month, day, day2, anchor_year, year=mw.ustring.match(date_string, "(%D-) +(%d%d?)[%-–](%d%d?), +((%d%d%d%d)%a?)");
 
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
 
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
Line 389: Line 389:  
year2=year;
 
year2=year;
   −
elseif mw.ustring.match(date_string, "^[1-9]%d? +%D- +[1-9]%d%d%d%a?$") then -- day-initial: day month year
+
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?)");
 
day, month, anchor_year, year=mw.ustring.match(date_string, "(%d%d*)%s*(%D-) +((%d%d%d%d?)%a?)");
 
month = get_month_number (month);
 
month = get_month_number (month);
 
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
 
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?[%-–][1-9]%d? +%D- +[1-9]%d%d%d%a?$") then -- day-range-initial: day–day month year; days are separated by endash
+
--[[ NOT supported at en.wiki
 +
elseif mw.ustring.match(date_string, "^[1-9]%d%d%d%a? +%D- +%d%d?$") then -- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed
 +
anchor_year, year, month, day=mw.ustring.match(date_string, "((%d%d%d%d?)%a?) +(%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
 +
-- end NOT supported at en.wiki ]]
 +
 
 +
elseif mw.ustring.match(date_string, "^[1-9]%d?[%-–][1-9]%d? +%D- +[1-9]%d%d%d%a?$") then -- day-range-initial: day–day month year; days are separated by endash
 
day, day2, month, anchor_year, year=mw.ustring.match(date_string, "(%d%d?)[%-–](%d%d?) +(%D-) +((%d%d%d%d)%a?)");
 
day, day2, month, anchor_year, year=mw.ustring.match(date_string, "(%d%d?)[%-–](%d%d?) +(%D-) +((%d%d%d%d)%a?)");
 
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
 
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
Anonymous user

Navigation menu