Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/DannyS712/remind
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!
-- This module powers {{countdown}}. local p = {} -- Constants local lang = mw.language.getContentLanguage() local getArgs = require('Module:Arguments').getArgs local function formatMessage(secondsLeft, event, color, refreshLink) local timeLeft = lang:formatDuration(secondsLeft, {'years', 'weeks', 'days', 'hours', 'minutes', 'seconds'}) -- Find whether we are plural or not. local isOrAre if string.match(timeLeft, '^%d+') == '1' then isOrAre = 'is' else isOrAre = 'are' end -- Color and bold the numbers, because it makes them look important. local timeLeft = string.gsub(timeLeft, '(%d+)', '<span style="color: ' .. (color or '#F00') .. '; font-weight: bold;">%1</span>') -- Make the refresh link and join it all together. return string.format('There %s %s until %s.%s', isOrAre, timeLeft, event, refreshLink) end function p.main(frame) local args = getArgs(frame) if not (args.year and args.month and args.day) then return '<strong class="error">Error: year, month, and day must be specified</strong>' end if not (args.reminder) then return '<strong class="error">Error: reminder must be specified</strong>' end local eventTime = os.time({year=args.year, month=args.month, day=args.day, hour=args.hour, min=args.minute, sec=args.second}) local timeToStart = os.difftime(eventTime, os.time()) -- (future time - current time) if timeToStart > 0 then -- Reminder still pending return '' else -- Reminder due return args.reminder end end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, 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 (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/DannyS712/remind/doc
(
edit
)