Jump to content

Module:Protection banner: Difference between revisions

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