Skip to content

Commit 460d607

Browse files
committed
Fix <time> tag validity
1 parent 235951b commit 460d607

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/methods/filters.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
use std::borrow::Borrow;
55
use time::format_description::well_known::Rfc3339;
66

7-
pub fn format_time(s: time::OffsetDateTime) -> Result<String, askama::Error> {
8-
s.format(&Rfc3339)
7+
pub fn format_time(s: impl Borrow<time::OffsetDateTime>) -> Result<String, askama::Error> {
8+
(*s.borrow())
9+
.format(&Rfc3339)
910
.map_err(Box::from)
1011
.map_err(askama::Error::Custom)
1112
}

templates/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</td>
4545
<td>
4646
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
47-
<time datetime="{{ repository.last_modified }}" title="{{ repository.last_modified }}">
47+
<time datetime="{{ repository.last_modified|format_time }}" title="{{ repository.last_modified|format_time }}">
4848
{{- repository.last_modified.clone()|timeago -}}
4949
</time>
5050
</a>

templates/repo/macros/refs.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{{ commit.get().author.name }}
1919
</td>
2020
<td>
21-
<time datetime="{{ commit.get().author.time }}" title="{{ commit.get().author.time }}">
21+
<time datetime="{{ commit.get().author.time|format_time }}" title="{{ commit.get().author.time|format_time }}">
2222
{{- commit.get().author.time|timeago -}}
2323
</time>
2424
</td>
@@ -50,7 +50,7 @@
5050
</td>
5151
<td>
5252
{% if let Some(tagger) = tag.get().tagger -%}
53-
<time datetime="{{ tagger.time }}" title="{{ tagger.time }}">
53+
<time datetime="{{ tagger.time|format_time }}" title="{{ tagger.time|format_time }}">
5454
{{- tagger.time|timeago -}}
5555
</time>
5656
{%- endif %}
@@ -74,7 +74,7 @@
7474
{% set commit = commit.get() %}
7575
<tr>
7676
<td>
77-
<time datetime="{{ commit.committer.time }}" title="{{ commit.committer.time }}">
77+
<time datetime="{{ commit.committer.time|format_time }}" title="{{ commit.committer.time|format_time }}">
7878
{{- commit.committer.time.clone()|timeago -}}
7979
</time>
8080
</td>

0 commit comments

Comments
 (0)