Module:Active hours
Revision as of 08:52, 12 February 2022 by Wikipedia>Utfor (create)
Module rating is invalid or not specified. |
Purpose
To inform other users if there is reason to believe you are not active at the moment, as based on your local time and a period of active hours you can specify in the module call.
Usage
{{User:Utfor/Active hours|timezone|beginningofactivehours|endofactivehours|{{CURRENTHOUR}}}}
Examples
Suppose the following:
- timezone = UTC+1
- beginning of active hours = 16 (16:00 Central European Time)
- end of active hours = 22 (22:00 Central European Time)
- {{CURRENTHOUR}}
This would be entered as the following:
{{User:Utfor/Active hours|1|16|22|{{CURRENTHOUR}}}}
And would return:
User:Utfor/Active hours
You may want to include a {{purge}} link as well.
Output
One of the following:
- This user is not necessarily unlikely to be active at the moment
- This user is unlikely to be active at the moment
local p = {};
p.hello = function( frame )
local f = frame:getParent().args
local tz = tonumber(f[1]) -- time zone, if UTC+1, then supply 1
local frm = (tonumber(f[2])-tonumber(tz)+48) % 24 -- beginning of active hours - if 16:00, then supply 16
local untl = (tonumber(f[3])-tonumber(tz)+48) % 24 -- end of active hours - if 22:00, then supply 22
if untl < frm then
untl = untl + 24
end
local tim = tonumber(f[4]) -- current hour, UTC
if (tim >= frm) and (tim < untl) then
str = "This user is not necessarily unlikely to be active at the moment"
else
str= "This user is unlikely to be active at the moment"
end
return str
end
return p