From 19c2c05c6f5220f4feedad99a38e0fb4dc57b957 Mon Sep 17 00:00:00 2001 From: WriterV2 Date: Thu, 21 Dec 2023 11:58:07 +0100 Subject: Adapt to new timestamp function which returns the date as an option --- src/works/stories.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/works/stories.rs') diff --git a/src/works/stories.rs b/src/works/stories.rs index cc9d0fa..8a6e4dc 100644 --- a/src/works/stories.rs +++ b/src/works/stories.rs @@ -118,7 +118,11 @@ impl Story { } else { 0 }; - let date = chrono::NaiveDateTime::from_timestamp(max(pdf_last_modification, html_last_modification), 0).date(); + let date = if let Some(d) = chrono::NaiveDateTime::from_timestamp_opt(max(pdf_last_modification, html_last_modification), 0) { + d.date() + } else { + chrono::NaiveDate::default() + }; self.last_update = date; Ok(date) } -- cgit v1.2.3