Skip to content

Commit a3a57a1

Browse files
Remove opt_data filter
1 parent 9f9efb6 commit a3a57a1

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/web/page/templates.rs

-8
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,6 @@ pub mod filters {
230230
Ok(((multiplier * *value).round() / multiplier).to_string())
231231
}
232232

233-
pub fn opt_date(value: &Option<DateTime<Utc>>, format: &str) -> rinja::Result<String> {
234-
if let Some(value) = value {
235-
Ok(value.format(format).to_string())
236-
} else {
237-
Ok(String::new())
238-
}
239-
}
240-
241233
pub fn split_first<'a>(value: &'a str, pat: &str) -> rinja::Result<Option<&'a str>> {
242234
Ok(value.split(pat).next())
243235
}

templates/releases/feed.xml

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
<id>urn:docs-rs:{{ crate::BUILD_VERSION }}</id>
1212
<updated>
1313
{%- if let Some(first_release) = recent_releases.get(0) -%}
14-
{{ first_release.build_time|opt_date("%+") }}
14+
{%- if let Some(build_time) = first_release.build_time -%}
15+
{{ build_time.format("%+") }}
16+
{%- endif -%}
1517
{%- endif -%}
1618
</updated>
1719

@@ -28,7 +30,11 @@
2830

2931
<link href="{{ link|safe }}" />
3032
<id>urn:docs-rs:{{ release.name }}:{{ release.version }}</id>
31-
<updated>{{ release.build_time|opt_date("%+") }}</updated>
33+
<updated>
34+
{% if let Some(build_time) = release.build_time -%}
35+
{{ build_time.format("%+") }}
36+
{%- endif -%}
37+
</updated>
3238

3339
<summary>
3440
{%- if let Some(description) = release.description -%}

0 commit comments

Comments
 (0)