Module:Protection banner: Difference between revisions
turn Blurb.formatDate into Blurb:_formatDate so that it can access the config
(get the expiry date format from a config message) |
(turn Blurb.formatDate into Blurb:_formatDate so that it can access the config) |
||
Line 350: | Line 350: | ||
end | end | ||
-- | -- Private methods -- | ||
function Blurb | function Blurb:_formatDate(num) | ||
-- Formats a Unix timestamp into dd Month, YYYY format. | -- Formats a Unix timestamp into dd Month, YYYY format. | ||
lang = lang or mw.language.getContentLanguage() | lang = lang or mw.language.getContentLanguage() | ||
Line 365: | Line 365: | ||
end | end | ||
end | end | ||
function Blurb:_getExpandedMessage(msgKey) | function Blurb:_getExpandedMessage(msgKey) | ||
Line 464: | Line 462: | ||
local expiry = self._protectionObj.expiry | local expiry = self._protectionObj.expiry | ||
if type(expiry) == 'number' then | if type(expiry) == 'number' then | ||
return | return self:_formatDate(expiry) | ||
else | else | ||
return expiry | return expiry | ||
Line 545: | Line 543: | ||
local protectionDate = self._protectionObj.protectionDate | local protectionDate = self._protectionObj.protectionDate | ||
if type(protectionDate) == 'number' then | if type(protectionDate) == 'number' then | ||
return | return self:_formatDate(protectionDate) | ||
else | else | ||
return protectionDate | return protectionDate |