gitscope
← rgit / Diff · 460d607 → 460d607
Changes 460d607..460d607
Patch commit
diff --git a/src/methods/filters.rs b/src/methods/filters.rs
index 273bb7e..b460102 100644
--- a/src/methods/filters.rs
+++ b/src/methods/filters.rs
@@ -4,8 +4,9 @@
use std::borrow::Borrow;
use time::format_description::well_known::Rfc3339;
-pub fn format_time(s: time::OffsetDateTime) -> Result<String, askama::Error> {
- s.format(&Rfc3339)
+pub fn format_time(s: impl Borrow<time::OffsetDateTime>) -> Result<String, askama::Error> {
+ (*s.borrow())
+ .format(&Rfc3339)
.map_err(Box::from)
.map_err(askama::Error::Custom)
}
diff --git a/templates/index.html b/templates/index.html
index e449aa0..8dc7bc5 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -44,7 +44,7 @@
</td>
<td>
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
- <time datetime="{{ repository.last_modified }}" title="{{ repository.last_modified }}">
+ <time datetime="{{ repository.last_modified|format_time }}" title="{{ repository.last_modified|format_time }}">
{{- repository.last_modified.clone()|timeago -}}
</time>
</a>
diff --git a/templates/repo/macros/refs.html b/templates/repo/macros/refs.html
index e802355..51128da 100644
--- a/templates/repo/macros/refs.html
+++ b/templates/repo/macros/refs.html
@@ -18,7 +18,7 @@
{{ commit.get().author.name }}
</td>
<td>
- <time datetime="{{ commit.get().author.time }}" title="{{ commit.get().author.time }}">
+ <time datetime="{{ commit.get().author.time|format_time }}" title="{{ commit.get().author.time|format_time }}">
{{- commit.get().author.time|timeago -}}
</time>
</td>
@@ -50,7 +50,7 @@
</td>
<td>
{% if let Some(tagger) = tag.get().tagger -%}
- <time datetime="{{ tagger.time }}" title="{{ tagger.time }}">
+ <time datetime="{{ tagger.time|format_time }}" title="{{ tagger.time|format_time }}">
{{- tagger.time|timeago -}}
</time>
{%- endif %}
@@ -74,7 +74,7 @@
{% set commit = commit.get() %}
<tr>
<td>
- <time datetime="{{ commit.committer.time }}" title="{{ commit.committer.time }}">
+ <time datetime="{{ commit.committer.time|format_time }}" title="{{ commit.committer.time|format_time }}">
{{- commit.committer.time.clone()|timeago -}}
</time>
</td>