Module:Date: Difference between revisions
Winterfoxo (talk | contribs) m 1 revision imported from wikipedia:Module:Date |
Winterfoxo (talk | contribs) m 1 revision imported from wikipedia:Module:Date |
||
| (One intermediate revision by one other user not shown) | |||
| Line 695: | Line 695: | ||
end | end | ||
-- | -- Cache the current date/time (UTC). | ||
-- | |||
-- Note that os.date() returns an empty object with optimized lazy getters for each field. | |||
-- Avoid current.min or current.sec in articles! https://phabricator.wikimedia.org/T416616 | |||
-- | |||
-- Beware that while os.date() uses 'min' and 'sec', our Date() uses 'minute' and 'second'. | |||
local current = os.date('!*t') | |||
local function extract_date(newdate, text) | local function extract_date(newdate, text) | ||
| Line 1,295: | Line 1,290: | ||
if argtype == 'currentdatetime' then | if argtype == 'currentdatetime' then | ||
newdate.hour = current.hour | newdate.hour = current.hour | ||
newdate.minute = current. | newdate.minute = current.min | ||
newdate.second = current. | newdate.second = current.sec | ||
newdate.hastime = true | newdate.hastime = true | ||
end | end | ||