Home
Random
Log in
Settings
About HighSpell Wiki
Disclaimers
HighSpell Wiki
Search
Editing
Module:PageDates
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} -- Properly handle ordinal suffixes local function ordinal(n) local v = n % 100 if v >= 11 and v <= 13 then return n .. "th" end local lastDigit = n % 10 if lastDigit == 1 then return n .. "st" elseif lastDigit == 2 then return n .. "nd" elseif lastDigit == 3 then return n .. "rd" else return n .. "th" end end function p.dates(frame) local lang = mw.language.getContentLanguage() local timestamp = frame:preprocess("{{REVISIONTIMESTAMP}}") -- Extract date parts local day = tonumber(lang:formatDate("j", timestamp)) local month = lang:formatDate("F", timestamp) local year = lang:formatDate("Y", timestamp) local formatted = string.format("%s %s, %s", month, ordinal(day), year) return formatted end return p
Summary:
Please note that all contributions to HighSpell Wiki are considered to be released under the CC BY-NC-SA 3.0 (see
HighSpell Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:PageDates/doc
(
edit
)