Module:LatestUpdate

From The Deadlock Wiki
Revision as of 02:06, 9 March 2026 by Monster Domosed (talk | contribs) (created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

This module calculates the days since the last update stored in Data:LatestUpdate.json and sends to Module:UpdateExcerpt to be displayed by Template:Deadlock Wiki/UpdateExcerpt. It can also be called to calculate the time since any given date, in days.

Examples

days_since_date

This function can be called to calculate the days passed from a given date, using the format "Month/Day/Year". "Month" has to be in numbers.

For days since January 30 2026:

{{#invoke:LatestUpdate|days_since_date|1|30|2026}}

Script error: The function "days_since_date" does not exist.

days_since

This is an automated function that calculates the days since the latest update stored in Data:LatestUpdate.json.

days_since_text

This is an automated function that wraps the "days_since" data in a localized text template to be used by Module:UpdateExcerpt.


local p = {}

-- Load JSON content from a page
local data = mw.loadJsonData("Data:LatestUpdate.json")
local update = data.latest_update

function p.month()
    return update.month
end

function p.day()
    return update.day
end

function p.year()
    return update.year
end

return p