Skip to content

Commit 17c8dcc

Browse files
authored
Fix compliance with Atom specification (#588)
* Remove nanoseconds from atom:updated element * Add missing import
1 parent d978379 commit 17c8dcc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
mod blogs;
22
mod posts;
33

4+
use chrono::Timelike;
45
use crate::blogs::Blog;
56
use crate::posts::Post;
67
use handlebars::{handlebars_helper, Handlebars};
@@ -162,7 +163,7 @@ impl<'a> Generator<'a> {
162163
let data = json!({
163164
"blog": blog,
164165
"posts": posts,
165-
"feed_updated": chrono::Utc::now().to_rfc3339(),
166+
"feed_updated": chrono::Utc::now().with_nanosecond(0).unwrap().to_rfc3339(),
166167
});
167168

168169
self.render_template(blog.prefix().join("feed.xml"), "feed", data)?;
@@ -185,7 +186,7 @@ impl<'a> Generator<'a> {
185186
.collect();
186187
let data = Releases {
187188
releases: releases,
188-
feed_updated: chrono::Utc::now().to_rfc3339(),
189+
feed_updated: chrono::Utc::now().with_nanosecond(0).unwrap().to_rfc3339(),
189190
};
190191
fs::write(
191192
self.out_directory.join(blog.prefix()).join("releases.json"),

0 commit comments

Comments
 (0)