Module:LatestUpdate: Difference between revisionsGive feedback
Add special-case "today"/"yesterday" wording for 0/1 days, with translations for all supported languages (with help from vergir-bot LLM) |
Gammaton32 (talk | contribs) added days_since_date to calculate time since any given date |
||
| Line 284: | Line 284: | ||
month = month_number, | month = month_number, | ||
day = tonumber(update.day), | day = tonumber(update.day), | ||
hour = 0 | |||
}) | |||
local now = os.time() | |||
local diff_seconds = os.difftime(now, update_time) | |||
local days = math.floor(diff_seconds / 86400) | |||
if days < 0 then | |||
return 0 | |||
end | |||
return days | |||
end | |||
p.days_since_date = function(frame) | |||
local update_time = os.time({ | |||
year = frame.args[3], | |||
month = frame.args[1], | |||
day = frame.args[2], | |||
hour = 0 | hour = 0 | ||
}) | }) | ||