Module:Time/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 671:
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
end
end
 
local function get_utc_offset_3 (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 minutes;
else
return nil; -- we require that all timezone table have what appears to be a valid offset
Line 834 ⟶ 849:
utc_offset = get_utc_offset (args[1]); -- utc offset for specified timezone
utc_offset_2 = get_utc_offset_2 (args[1]);
utc_offset_3 = get_utc_offset_3 (args[1]);
timestamp = utc_timestamp + utc_offset; -- make local time timestamp
 
Line 889 ⟶ 905:
 
local refreshLink = mw.title.getCurrentTitle():fullUrl{action = 'purge'} -- create a refresh link
return string.format ('%s : %s', utc_offset_2, utc_offset_3);
 
end