pasta times are in systems local timezone

This commit is contained in:
dvdsk 2022-07-13 23:55:28 +02:00
parent de2cc48f88
commit 738e036cb5
No known key found for this signature in database
GPG key ID: 6CF9D20C5709A836

View file

@ -1,6 +1,6 @@
use std::fmt;
use chrono::{DateTime, Datelike, NaiveDateTime, Timelike, Utc};
use chrono::{Datelike, Timelike, Local, TimeZone};
use serde::{Deserialize, Serialize};
use crate::util::animalnumbers::to_animal_names;
@ -25,7 +25,7 @@ impl Pasta {
}
pub fn created_as_string(&self) -> String {
let date = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(self.created, 0), Utc);
let date = Local.timestamp(self.created, 0);
format!(
"{:02}-{:02} {:02}:{:02}",
date.month(),
@ -39,8 +39,7 @@ impl Pasta {
if self.expiration == 0 {
String::from("Never")
} else {
let date =
DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(self.expiration, 0), Utc);
let date = Local.timestamp(self.expiration, 0);
format!(
"{:02}-{:02} {:02}:{:02}",
date.month(),