1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 10:48:37 +00:00

Refactor DateUtils and merge TimeSince (#32409)

Follow #32383 and #32402
This commit is contained in:
wxiaoguang
2024-11-04 19:30:00 +08:00
committed by GitHub
parent 61be51e56b
commit b068dbd40e
74 changed files with 241 additions and 228 deletions

View File

@@ -78,7 +78,7 @@
{{$reviewer := index .GetIssueInfos 1}}
{{ctx.Locale.Tr "action.review_dismissed" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx) $reviewer}}
{{end}}
{{TimeSince .GetCreate ctx.Locale}}
{{DateUtils.TimeSince .GetCreate}}
</div>
{{if .GetOpType.InActions "commit_repo" "mirror_sync_push"}}
{{$push := ActionContent2Commits .}}

View File

@@ -104,19 +104,19 @@
{{if .UpdatedUnix}}
<div class="flex-text-block">
{{svg "octicon-clock"}}
{{ctx.Locale.Tr "repo.milestones.update_ago" (TimeSinceUnix .UpdatedUnix ctx.Locale)}}
{{ctx.Locale.Tr "repo.milestones.update_ago" (DateUtils.TimeSince .UpdatedUnix)}}
</div>
{{end}}
<div class="flex-text-block">
{{if .IsClosed}}
{{$closedDate:= TimeSinceUnix .ClosedDateUnix ctx.Locale}}
{{$closedDate:= DateUtils.TimeSince .ClosedDateUnix}}
{{svg "octicon-clock" 14}}
{{ctx.Locale.Tr "repo.milestones.closed" $closedDate}}
{{else}}
{{if .DeadlineString}}
<span{{if .IsOverdue}} class="text red"{{end}}>
{{svg "octicon-calendar" 14}}
{{ctx.DateUtils.AbsoluteShort (.DeadlineString|ctx.DateUtils.ParseLegacy)}}
{{DateUtils.AbsoluteShort (.DeadlineString|DateUtils.ParseLegacy)}}
</span>
{{else}}
{{svg "octicon-calendar" 14}}