Jump to content

Module:Duration and Module:Duration/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
Fix error message per edit request
 
m DannyS712 moved page Module:Hms/sandbox to Module:Duration/sandbox without leaving a redirect: requested move; consensus at Module talk:Duration
 
Line 2: Line 2:


function p._error( error_str )
function p._error( error_str )
return '[[Category:Duration with input error]]<strong class="error">Error in Module:Duration: ' .. error_str .. '</strong>'
return '[[Category:Duration with input error]]<strong class="error">Error in Module:Hms: ' .. error_str .. '</strong>'
end
end


Line 38: Line 38:
for k, v in ipairs(duration) do duration[k] = tonumber(v) or 0 end -- convert values to numbers
for k, v in ipairs(duration) do duration[k] = tonumber(v) or 0 end -- convert values to numbers
end
end
if not duration[3] and duration[1] >= 60 then
table.insert(duration, 1, math.floor(duration[1]/60))
duration[2] = duration[2] - duration[1]*60
end
if not duration[3] and duration[1] >= 60 then table.insert(duration, 1, math.floor(duration[1]/60)) ; duration[2] = duration[2] - duration[1]*60 end
if duration[3] then
if duration[3] then
if (duration[1] + duration[2] + duration[3]) == 0 then return nil end
if (duration[1] + duration[2] + duration[3]) == 0 then return nil end