Module:Time ago and Module:Time ago/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
add new feature "|numeric" to print number only |
properly implement args.now to set what should be used for the current time when testing |
||
Line 60: | Line 60: | ||
-- Store the difference between the current time and the inputted time, as well as its absolute value. |
-- Store the difference between the current time and the inputted time, as well as its absolute value. |
||
-- Normally args.now == nil which means the current time is used for "now"; args.now can be set for testing. |
|||
local timeDiff = lang:formatDate( |
local timeDiff = lang:formatDate('xnU', args.now) - inputTime |
||
local absTimeDiff = math.abs( |
local absTimeDiff = math.abs(timeDiff) |
||
if magnitude then |
if magnitude then |
||
Line 103: | Line 104: | ||
if input then |
if input then |
||
local id |
local id |
||
if |
if args.now then |
||
id = args.now |
|||
elseif input.hour == 0 and input.minute == 0 then |
|||
id = 'currentdate' |
id = 'currentdate' |
||
else |
else |
||
Line 157: | Line 160: | ||
result_num_text = tostring( result_num ) |
result_num_text = tostring( result_num ) |
||
end |
end |
||
-- numeric or string |
-- numeric or string |
||
local numeric_out = args.numeric |
local numeric_out = args.numeric |