Module:Time/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 404:
local utc_offset; -- true when southern hemisphere
local DF; -- date format flag; the |df= parameter
local is_dst; -- wether or not dst is active
local is_dst = tonumber(is_dst_active(timestamp))
local data = 'Module:Time/data'..set_sandbox(frame) -- make a data module name; sandbox or live
data = mw.loadData (data); -- load the data module
Line 469:
utc_offset = get_utc_offset (); -- utc offset for specified timezone in seconds
timestamp = utc_timestamp + utc_offset; -- make local time timestamp
 
local is_dst = tonumber(is_dst_active(timestamp))
if 'no' == 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
elseifif 'alwaysno' == DST or is_dst == 0 then -- ifdst neededisn't toactive alwaysor display dstnot timeobserved
tz_abbr = tz.abbr; -- ... dst is not observed (|dst=no) show time asuse standard time
elseif 'always' == DST or is_dst == 1 then -- if dst is set to always or dst is active
timestamp = timestamp + 3600; -- add a hour for dst
tz_abbr = tz.dst_abbr; -- dst abbreviation
else -- error at is_dst_active
else
return is_dst -- return the error
if is_dst ~= 0 and is_dst ~= 1 then
return is_dst
elseif is_dst == 1 then
timestamp = timestamp + 3600;
tz_abbr = tz.dst_abbr;
else
tz_abbr = tz.abbr;
end
end