Module:Format time/sandbox

This is the current revision of this page, as edited by HouseBlaster (talk | contribs) at 16:24, 23 August 2025 (test). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local p = {}

function p.main(frame)
	args = require('Module:Arguments').getArgs(frame)
	return p._main{fmt = args['fmt'], s = args['s'] or args[1]}
end

function p._main(args)
	-- args is a table with two values:
	-- fmt = the format to output the time, according to [[:mw:Help:Extension:ParserFunctions##time]] (default: j xg Y)
	-- s (or [1]) = the string to process; should be a date (default: empty string)
	return mw.getContentLanguage():formatDate(args.fmt or 'j xg Y', require('Module:YMD to ISO')._main(args.s or args[1]), false)
end

return p