Module talk:Time: Difference between revisions

Content deleted Content added
Line 40:
== Template-protected edit request on 8 August 2018 ==
 
{{edit template-protected|Module:Time|answered=yes}}{{collapse top}}<syntaxhighlight lang=Lua>
local function get_utc_offset_hour (timezone)
local hours;
Line 93:
 
end</syntaxhighlight>
{{collapse bottom}}
 
* These edits add a function which allows the module to output the UTC offset of a timezone. The output would be able to replace many templates and would allow [[Template:Infobox time zone]] to work more reliably. I've done testing to make sure both positive and negative UTC offsets work and function time still works [[User:BrandonXLF/sandbox2|here]]. — [[User:BrandonXLF|<span style="outline: 3px double blue;color:lightcyan;background-color:black;'>&nbsp;'''''BrandonXLF'''''&nbsp;</span>]]&nbsp;&nbsp;[[User talk:BrandonXLF|<sup>(t@lk)</sup>]]&nbsp;<span style="color:black"><sup>([[Template:Ping|ping back]])</sup></span> 15:34, 8 August 2018 (UTC)
:I added {{tag|syntaxhighlight}} to make your code more readable. How does this change make {{tlx|Infobox time zone}} {{tq|work more reliably}}? If that template is 'unreliable', shouldn't fixes be applied there? Why is your proposed code so complex? Can't it be made simpler?
:—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 16:04, 8 August 2018 (UTC)
::Wouldn't this work just as well?{{collapse top}}
<syntaxhighlight lang=Lua style="margin-left:4.8em">function p.offset (frame)
local args = getArgs(frame);
Line 110:
return table.concat ({'[[UTC', tz[args[1]].utc_offset:gsub ('^(%d)', '+%1'):gsub ('^-', '−'), ']]'});
end</syntaxhighlight>
{{collapse bottom}}
::—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 16:37, 8 August 2018 (UTC)
{{ping|Trappist the monk}} Yes it would, because it's smaller and more efficient I prefer if your code is added. It makes {{tlx|Infobox time zone}} more reliable because currently it's using a template that doesn't have a lot of timezone, where as Module:time as a lot of time zones already. — [[User:BrandonXLF|<span style="outline: 3px double blue;color:lightcyan;background-color:black;'>&nbsp;'''''BrandonXLF'''''&nbsp;</span>]]&nbsp;&nbsp;[[User talk:BrandonXLF|<sup>(t@lk)</sup>]]&nbsp;<span style="color:black"><sup>([[Template:Ping|ping back]])</sup></span> 16:51, 8 August 2018 (UTC)
Line 118 ⟶ 119:
::—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 10:33, 9 August 2018 (UTC)
:::{{ping|Trappist the monk}} I'll figure something out. — [[User:BrandonXLF|<span style="outline: 3px double blue;color:lightcyan;background-color:black;'>&nbsp;'''''BrandonXLF'''''&nbsp;</span>]]&nbsp;&nbsp;[[User talk:BrandonXLF|<sup>(t@lk)</sup>]]&nbsp;<span style="color:black"><sup>([[Template:Ping|ping back]])</sup></span> 14:27, 9 August 2018 (UTC)
:Related to the above, I have moved the /sandbox data table to [[Module:Time/data/sandbox]]. This ought to make is easier to create a utc offsets table and function.
:—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 15:10, 11 August 2018 (UTC)
 
== Template-protected edit request on 9 August 2018 ==