|
|
@@ -87,11 +87,11 @@ impl PageFrontMatter { |
|
|
|
pub fn date_to_datetime(&mut self) { |
|
|
|
self.datetime = if let Some(ref d) = self.date { |
|
|
|
if d.contains('T') { |
|
|
|
DateTime::parse_from_rfc3339(&d).ok().and_then(|s| Some(s.naive_local())) |
|
|
|
DateTime::parse_from_rfc3339(&d).ok().map(|s| s.naive_local()) |
|
|
|
} else { |
|
|
|
NaiveDate::parse_from_str(&d, "%Y-%m-%d") |
|
|
|
.ok() |
|
|
|
.and_then(|s| Some(s.and_hms(0, 0, 0))) |
|
|
|
.map(|s| s.and_hms(0, 0, 0)) |
|
|
|
} |
|
|
|
} else { |
|
|
|
None |
|
|
|