Skip to content

Commit

Permalink
web: Use DateTime::from_timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinnerbone committed Mar 6, 2024
1 parent 1a6b73f commit d3e12e4
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions web/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -71,8 +68,7 @@ impl FileDialogResult for WebFileDialogResult {
fn modification_time(&self) -> Option<DateTime<Utc>> {
#[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
}
Expand Down

0 comments on commit d3e12e4

Please sign in to comment.