Module:Time/sandbox: Difference between revisions

Content deleted Content added
Reverted to revision 958641998 by Andrybak (talk): Test (TW)
use Module:Yesno to check boolean value of variable "DST": nil value defaulted to true, because Module:Yesno converts nil to nil; check for 'always' needs to go up
Line 368:
local Hide_tz = yesno(first_set (cfg.aliases['hide-tz'], args)); -- boolean
local Unlink_tz = yesno(first_set (cfg.aliases['unlink-tz'], args)); -- boolean
local DST = first_set (cfg.aliases['dst'], args) or true; -- string 'always' or boolean
local Lang = first_set (cfg.aliases['lang'], args); -- to render in a language other than the local wiki's language
Line 424:
timestamp = utc_timestamp + utc_offset; -- make local time timestamp
 
if 'noalways' == DST then -- forif timezonesneeded thatto DOalways observedisplay dst but for this ___location ...time
tz_abbr = tz.abbr; -- ... dst is not observed (|dst=no) show time as standard time
elseif 'always' == DST then -- if needed to always display dst time
timestamp = timestamp + 3600; -- add a hour for dst
tz_abbr = tz.dst_abbr; -- dst abbreviation
elseif not yesno(DST) then -- for timezones that DO observe dst but for this ___location ...
tz_abbr = tz.abbr; -- ... dst is not observed (|dst=no) show time as standard time
else
if is_set (tz.dst_begins) and is_set (tz.dst_ends) and is_set (tz.dst_time) then -- make sure we have all of the parts