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

 

词条 Module:Offset
释义

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

local p = {}

local data = 'module:time/data/sandbox'

data = mw.loadData (data)

local tz = data.tz_data;

local alt = data.tz_aliases;

local dst = data.dst_tz;

function p.offset(frame)

local args = getArgs(frame)

local minute;

local hour;

local sign;

if not args[1] then

args[1] = 'utc'

else

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

end

if not args['type'] then

args['type'] =

end

if args['type']:match('m') then

args['type'] = 'minute'

elseif args['type']:match('h') then

args['type'] = 'hour'

end

if alt[args[1]] then

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

elseif dst[args[1]] then

args[1] = dst[args[1]]

args['dst'] = 'yes'

end

if tz[args[1]] then

args[1] = tz[args[1]]["utc_offset"];

hour,minute = args[1]:match('(%d+):(%d+)')

sign = args[1]:match('(-)')

else

hour,minute = ,

end

if not sign then

sign =

end

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

hour = tonumber(hour)+1

end

if hour == mw.ustring.match(hour,'%d%d') then

hour = mw.ustring.gsub(hour,'0',,1)

end

if minute == mw.ustring.match(minute,'%d%d')

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

minute = mw.ustring.gsub(minute,'0',,1)

end

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

return sign..hour

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

return minute

else

return sign..hour..':'..minute

end

end

return p

随便看

 

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

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/11 6:22:22