Open main menu

Changes

Module:Date

211 bytes added, 02:55, 3 August 2020
update from sandbox: implement show=M (minutes) and show=s (seconds); better method to fill a partial date
-- Return filled date1, date2 (two full dates).
local function filled(a, b)
-- Return date a filled, if necessary, with month and/or day from date b.
-- The filled day is truncated to fit the number of days in the month.
local fillmonth, fillday
if not a.month then
end
if fillmonth or fillday then -- need to create a new date
if a = Date(fillmonth or a., { month) =fillmonth, day = 2 and math.min(fillday or a.day) == 29 then -- Avoid invalid date, for example with {{age|2013|29 Feb 2016}} or {{age|Feb 2013|29 Jan 2015}}. if not is_leap_yeardays_in_month(a.year, fillmonth or a.month, a.calendar) then fillday = 28 end) end a = Date(a, { month = fillmonth, day = fillday })
end
return a
end
local H, M, S = diff.hours, diff.minutes, diff.seconds
if code == 'dh' or code == 'dhm' or code == 'dhms' or code == 'h' or code == 'hm' or code == 'hms' or code == 'M' or code == 's' then
local days = floor(diff.age_days + extra_days)
local inc_hour
inc_hour = true
end
end
elseif code == 'M' then
if S >= 30 then
M = M + 1
end
else
elseif code == 'hm' then
return hours, M
elseif code == 'M' or code == 's' then
M = hours * 60 + M
if code == 'M' then
return M
end
return M * 60 + S
end
return hours, M, S
Anonymous user