From d60b5f1e89f6ce9e5f6d58c21cb36f349d6b0e51 Mon Sep 17 00:00:00 2001
From: Gusted <williamzijl7@hotmail.com>
Date: Tue, 25 Jan 2022 21:50:02 +0000
Subject: [PATCH] Fix commit's time (#18375) (#18409)

- Backport of #18375
---
 templates/repo/commits_list.tmpl | 6 +++++-
 templates/repo/view_list.tmpl    | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl
index 66138e2138..6f41e6d693 100644
--- a/templates/repo/commits_list.tmpl
+++ b/templates/repo/commits_list.tmpl
@@ -76,7 +76,11 @@
 							<pre class="commit-body" style="display: none;">{{RenderCommitBody .Message $.RepoLink $.Repository.ComposeMetas}}</pre>
 							{{end}}
 						</td>
-						<td class="text right aligned">{{TimeSince .Author.When $.Lang}}</td>
+						{{if .Committer}}
+							<td class="text right aligned">{{TimeSince .Committer.When $.Lang}}</td>
+						{{else}}
+							<td class="text right aligned">{{TimeSince .Author.When $.Lang}}</td>
+						{{end}}
 					</tr>
 				{{end}}
 			</tbody>
diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl
index fc66fb6b2d..73bcacc1e2 100644
--- a/templates/repo/view_list.tmpl
+++ b/templates/repo/view_list.tmpl
@@ -30,7 +30,7 @@
 				{{end}}
 				</span>
 			</th>
-			<th class="text grey right age">{{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}}</th>
+			<th class="text grey right age">{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When $.Lang}}{{end}}{{end}}</th>
 		</tr>
 	</thead>
 	<tbody>