Module:Citation/CS1/Date validation: Difference between revisions

Jump to navigation Jump to search
Created page with "--[[--------------------------< F O R W A R D D E C L A R A T I O N S >-------------------------------------- ]] local add_prop_cat, is_set, in_array, set_message, substitute, wrap_style; -- imported functions from selected Module:Citation/CS1/Utilities local cfg; -- table of tables imported from selected Module:Citation/CS1/Configuration --[[--------------------------< F I L E - S C O P E D E C L A R A T I O N S >--------------------------------..."
imported>Trappist the monk
(update per RfC;)
(Created page with "--[[--------------------------< F O R W A R D D E C L A R A T I O N S >-------------------------------------- ]] local add_prop_cat, is_set, in_array, set_message, substitute, wrap_style; -- imported functions from selected Module:Citation/CS1/Utilities local cfg; -- table of tables imported from selected Module:Citation/CS1/Configuration --[[--------------------------< F I L E - S C O P E D E C L A R A T I O N S >--------------------------------...")
Line 19: Line 19:


returns true if:
returns true if:
Stiles.casa Wiki start date <= accessdate < today + 2 days
Wikipedia start date <= accessdate < today + 2 days


Stiles.casa Wiki 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)
Wikipedia 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 |access-date= at time 00:00:00 UTC
accessdate is the date provided in |access-date= 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
Line 49: Line 49:
end
end


if 979516800 <= access_ts and access_ts < tomorrow_ts then -- Stiles.casa Wiki start date <= accessdate < tomorrow's date
if 979516800 <= access_ts and access_ts < tomorrow_ts then -- Wikipedia start date <= accessdate < tomorrow's date
return true;
return true;
else
else
Line 459: Line 459:
--[[--------------------------< C H E C K _ D A T E >----------------------------------------------------------
--[[--------------------------< C H E C K _ D A T E >----------------------------------------------------------


Check date format to see that it is one of the formats approved by SW:DATESNO or SW:DATERANGE. Exception: only
Check date format to see that it is one of the formats approved by WP:DATESNO or WP:DATERANGE. Exception: only
allowed range separator is endash.  Additionally, check the date to see that it is a real date: no 31 in 30-day
allowed range separator is endash.  Additionally, check the date to see that it is a real date: no 31 in 30-day
months; no 29 February when not a leap year.  Months, both long-form and three character abbreviations, and seasons
months; no 29 February when not a leap year.  Months, both long-form and three character abbreviations, and seasons

Navigation menu