请输入您要查询的百科知识:

 

词条 Module:Offset/sandbox
释义

local data = require('module:time/data').tz_data

local alt = require('module:time/data').tz_aliases

local getArgs = require('module:arguments').getArgs

local p = {}

function p.offset(frame)

local args = getArgs(frame)

local minute;

local hour;

if not args[1] then

return ""

else

args[1] = args[1]:lower()

end

if args['type'] == 'min' or args['type'] == 'm' then

args['type'] = 'minute'

elseif args['type'] == 'h' then

args['type'] = 'hour'

end

if alt[args[1]] then

args[1] = alt[args[1]]

end

if data[args[1]] then

hour,minute = mw.ustring.match(data[args[1]]["utc_offset"],'(%d+):(%d+)')

else

hour,minute = ""

end

if args['dst'] == 'yes' then

hour = tonumber(hour)+1

end

if args['type'] == 'hour' then

return hour

elseif args['type'] == 'minute' then

return minute

else

return table.concat({hour,':',minute})

end

end

return p

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/21 13:38:32