Skip to content

Commit 66a3634

Browse files
committed
Display local time instead of UTC
Fixes #39.
1 parent 3a4acc2 commit 66a3634

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/widgets/message_row.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::io::Read;
22

33
use adw::prelude::*;
44
use adw::subclass::prelude::*;
5-
use chrono::NaiveDateTime;
5+
use chrono::{Local, TimeZone};
66
use gtk::{gdk, gio, glib};
77
use ntfy_daemon::models;
88
use tracing::error;
@@ -50,7 +50,9 @@ impl MessageRow {
5050

5151
let time = gtk::Label::builder()
5252
.label(
53-
&NaiveDateTime::from_timestamp_opt(msg.time as i64, 0)
53+
&Local
54+
.timestamp_opt(msg.time as i64, 0)
55+
.earliest()
5456
.map(|time| time.format("%Y-%m-%d %H:%M:%S").to_string())
5557
.unwrap_or_default(),
5658
)

0 commit comments

Comments
 (0)