From d3e12e4a240f545517c33b0c704a4fb197415154 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Wed, 6 Mar 2024 20:53:03 +0100 Subject: [PATCH] web: Use DateTime::from_timestamp --- web/src/ui.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/web/src/ui.rs b/web/src/ui.rs index f61ce898739d..8ddd5dac6c16 100644 --- a/web/src/ui.rs +++ b/web/src/ui.rs @@ -14,9 +14,6 @@ use web_sys::{HtmlCanvasElement, HtmlDocument, HtmlTextAreaElement}; use chrono::{DateTime, Utc}; -#[cfg(target_arch = "wasm32")] -use chrono::{NaiveDateTime, TimeZone}; - #[derive(Debug)] struct FullScreenError { jsval: String, @@ -71,8 +68,7 @@ impl FileDialogResult for WebFileDialogResult { fn modification_time(&self) -> Option> { #[cfg(target_arch = "wasm32")] if let Some(handle) = &self.handle { - NaiveDateTime::from_timestamp_opt(handle.inner().last_modified() as i64, 0) - .map(|ts| Utc.from_utc_datetime(&ts)) + DateTime::from_timestamp(handle.inner().last_modified() as i64, 0) } else { None }