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