Module:Age/sandbox: Difference between revisions

Content deleted Content added
m Fix invalid self-closed HTML tag or other HTML tag error
support show=dhms and show=hms per request at Template talk:Time interval
Line 46:
-- Return formatted message text for an error.
-- Can append "#FormattingError" to URL of a page with a problem to find it.
local anchor = '<span id="FormattingError" ></span>'
local category
if not nocat and mw.title.getCurrentTitle():inNamespaces(0, 10) then
Line 146:
w = { 'w', id = 'w' },
wd = { 'w', 'd', id = 'wd' },
h = { 'H', id = 'h' },
hm = { 'H', 'M', id = 'hm' },
hms = { 'H', 'M', 'S', id = 'hms' },
d = { 'd', id = 'd' },
dh = { 'd', 'H', id = 'dh' },
dhm = { 'd', 'H', 'M', id = 'dhm' },
dhms = { 'd', 'H', 'M', 'S', id = 'dhms' },
ymdh = { 'y', 'm', 'd', 'H', id = 'ymdh' },
ymdhm = { 'y', 'm', 'd', 'H', 'M', id = 'ymdhm' },
Line 292 ⟶ 296:
H = 'hour',
M = 'minute',
S = 'second',
},
abbr_on = {
Line 300 ⟶ 305:
H = 'h',
M = 'm',
S = 's',
},
abbr_infant = { -- for {{age for infant}}
Line 310 ⟶ 316:
H = 'hr',
M = 'min',
S = 'sec',
},
abbr_raw = {},
Line 369 ⟶ 376:
end
local values = { diff:age(show.id, diff_options) }
if values[1] then
return make_text(values, show, names[abbr], text_options)
end
return message('Parameter show=' .. show.id .. ' is not supported here')
end