Sari la conținut

Modul:Date

De la Wikipedia, enciclopedia liberă
(dif) ← Versiunea anterioară | afișează versiunea curentă (dif) | Versiunea următoare → (dif)

Implementează {{Dată}}.


local DateUtils = require('Modul:DateUtils')
local p = {}

p.formatDateFromFrame = function(frame)
	local args = getArgs(frame)
	local dateObj = {}
	if args[1] then
		dateObj = DateUtils.parseDate(args[1])
	end
	if args[2] then
		dateObj.month = tonumber(months[args[2]] or args[2])
		if args[3] then dateObj.day = tonumber(args[3]) end
	end
	dateObj.calendar = 'gregorian'
	if not dateObj.precision then
		dateObj.precision = 9
	end
	if args[2] ~= nil then
		dateObj.precision = 10
		if args[3] ~= nil then
			dateObj.precision = 11
		end
	end
	return DateUtils.formatDate(dateObj, args['link'] ~= nil)
end

return p