Module:Date: Difference between revisions

96 bytes removed ,  8 years ago
replace kludge using global set_current_for_test so Module:No globals can be used by a module requiring Module:Date
(update from Module:Date/sandbox; major refactor to support new features in Module:Age)
(replace kludge using global set_current_for_test so Module:No globals can be used by a module requiring Module:Date)
Line 696: Line 696:


-- A table to get the current date/time (UTC), but only if needed.
-- A table to get the current date/time (UTC), but only if needed.
-- A local test can set the global variable to produce fixed results.
local current = setmetatable({}, {
local current = setmetatable(
set_current_for_test or {}, {
__index = function (self, key)
__index = function (self, key)
local d = os.date('!*t')
local d = os.date('!*t')
Anonymous user