Module:Time ago/testcases: Difference between revisions

Content deleted Content added
Add 2 more test cases.
Forgot to make these local variables.
Line 6:
-- Calculate the time since/until the test dates here, so that the test cases do not fail in the future.
local currentTime = lang:formatDate( 'U' )
local jul09 = currentTime - lang:formatDate( 'U', '1 July 2009' )
local secondssincejul09 = math.floor( jul09 )
local minutessincejul09 = math.floor( jul09 / 60 )
local dayssincejul09 = math.floor( jul09 / 86400 )
local weekssincejul09 = math.floor( jul09 / 604800 )
local monthssincejul09 = math.floor( jul09 / 2678400 )
local yearssincejul09 = math.floor( jul09 / 31557600 )
local monthssincesep13 = math.floor( ( currentTime - lang:formatDate( 'U', '15 September 2013' ) ) / 2678400 )
local monthsuntiljul49 = math.floor( ( lang:formatDate ( 'U', '1 July 2049' ) - currentTime ) / 2678400 )
local yearsuntilaug57 = math.floor( ( lang:formatDate ( 'U', '4 August 2057' ) - currentTime ) / 31557600 )
self:preprocess_equals('{{#invoke:TimeAgo|main|15 September 2013}}', monthssincesep13 .. ' months ago')