Module:Time/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 657:
if is_set (hours) and is_set (minutes) then
return sign * ((hours * 3600) + (minutes * 60));
else
return nil; -- we require that all timezone table have what appears to be a valid offset
end
end
 
local function get_utc_offset_2 (timezone)
local sign;
local hours;
local minutes;
sign, hours, minutes = mw.ustring.match (tz[timezone].utc_offset, '([%+%-±−]?)(%d%d):(%d%d)');
if '-' == sign then sign = -1; else sign = 1; end
if is_set (hours) and is_set (minutes) then
return sign*hours*':'*minutes;
else
return nil; -- we require that all timezone table have what appears to be a valid offset
Line 818 ⟶ 833:
end
utc_offset = get_utc_offset (args[1]); -- utc offset for specified timezone
utc_offset_2 = get_utc_offset_2 (args[1]);
timestamp = utc_timestamp + utc_offset; -- make local time timestamp
 
Line 873 ⟶ 889:
 
local refreshLink = mw.title.getCurrentTitle():fullUrl{action = 'purge'} -- create a refresh link
return string.format ('%s', utc_offsetutc_offset_2);
 
end