feat(object): render author/committer/tagger dates in human form

This commit is contained in:
2026-05-26 23:47:13 +02:00
parent 22309fe8fd
commit 182e507dc7
5 changed files with 85 additions and 19 deletions
+17
View File
@@ -120,6 +120,23 @@ function M.split_lines(content)
return lines
end
---@param ts integer
---@param tz string
---@return string
function M.format_git_time(ts, tz)
local sign, hh, mm = tz:match("^([+-])(%d%d)(%d%d)$")
local offset = 0
if sign then
local h = tonumber(hh) or 0
local m = tonumber(mm) or 0
offset = math.floor(h * 3600 + m * 60)
if sign == "-" then
offset = -offset
end
end
return os.date("!%a %b %e %T %Y ", ts + offset) .. tz
end
---@param buf integer
---@param ns integer
---@param lines string[]