Skip to content

Commit 5808515

Browse files
committed
fix warnings
1 parent ecb7932 commit 5808515

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/components/utils/logitems.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ impl From<CommitInfo> for LogEntry {
3131
if date.is_none() {
3232
log::error!("error reading commit date: {hash_short} - timestamp: {}",c.time);
3333
}
34-
DateTime::<Local>::from(DateTime::<Utc>::from_utc(
35-
date.unwrap_or_default(),
36-
Utc,
37-
))
34+
DateTime::<Local>::from(
35+
DateTime::<Utc>::from_naive_utc_and_offset(
36+
date.unwrap_or_default(),
37+
Utc,
38+
),
39+
)
3840
};
3941

4042
let author = c.author;

src/components/utils/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ macro_rules! try_or_popup {
2828

2929
/// helper func to convert unix time since epoch to formated time string in local timezone
3030
pub fn time_to_string(secs: i64, short: bool) -> String {
31-
let time = DateTime::<Local>::from(DateTime::<Utc>::from_utc(
32-
NaiveDateTime::from_timestamp_opt(secs, 0)
33-
.unwrap_or_default(),
34-
Utc,
35-
));
31+
let time = DateTime::<Local>::from(
32+
DateTime::<Utc>::from_naive_utc_and_offset(
33+
NaiveDateTime::from_timestamp_opt(secs, 0)
34+
.unwrap_or_default(),
35+
Utc,
36+
),
37+
);
3638

3739
time.format(if short {
3840
"%Y-%m-%d"

0 commit comments

Comments
 (0)