Module:Protection banner: Difference between revisions

use lang:formatDate instead of os.date as it is easier to localise
(format date output in the Blurb class)
(use lang:formatDate instead of os.date as it is easier to localise)
Line 187: Line 187:
function Blurb.formatDate(num)
function Blurb.formatDate(num)
-- Formats a Unix timestamp into dd M, YYYY format.
-- Formats a Unix timestamp into dd M, YYYY format.
local date = os.date('%e %B %Y', num)
lang = lang or mw.language.getContentLanguage()
-- The %e option replaces leading zeroes with spaces, but we don't want
local success, date = pcall(
-- spaces.
lang.formatDate,
date = date:gsub('^ ', '')
lang,
return date
'j F Y',
'@' .. tostring(num)
)
if success then
return date
end
end
end