模組:Chinese date
外观
require('Module:No globals')
local getArgs = require('Module:Arguments').getArgs
local p = {}
local function toChineseDate(format, date)
return mw.getCurrentFrame():callParserFunction('#time', format, date)
end
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p._main(args)
-- Main module code goes here.
local date = require('Module:ISODate')._dates(args)
if string.match(date, '^%d+%-%d%d%-%d%d$') then
return toChineseDate('Y年Mj日', date)
end
if string.match(date, '^%d+%-%d%d$') then
return toChineseDate('Y年M', date)
end
if string.match(date, '^%d+$') then
return toChineseDate('Y年', date)
end
return date
end
return p