feat(object): render author/committer/tagger dates in human form
This commit is contained in:
@@ -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[]
|
||||
|
||||
Reference in New Issue
Block a user