diff --git a/migration.sql b/migration.sql
index e00eef4..6faf5bb 100644
--- a/migration.sql
+++ b/migration.sql
@@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS "user_trip" (
CREATE TABLE IF NOT EXISTS "log" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"msg" text NOT NULL,
- "created_at" text NOT NULL DEFAULT CURRENT_TIMESTAMP
+ "created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS "location" (
diff --git a/src/model/log.rs b/src/model/log.rs
index 9861760..b1314ea 100644
--- a/src/model/log.rs
+++ b/src/model/log.rs
@@ -1,10 +1,11 @@
+use chrono::{DateTime, Local, NaiveDateTime, Utc};
use serde::{Deserialize, Serialize};
use sqlx::{FromRow, SqlitePool};
#[derive(FromRow, Debug, Serialize, Deserialize)]
pub struct Log {
pub msg: String,
- pub created_at: String,
+ pub created_at: NaiveDateTime,
}
impl Log {
@@ -40,8 +41,10 @@ LIMIT 1000
An RSS feed with activities from app.rudernlinz.at"#,
);
for log in Self::last(db).await {
+ let utc_time: DateTime = DateTime::from_utc(log.created_at, Utc);
+ let local_time = utc_time.with_timezone(&Local);
ret.push_str("- ");
- ret.push_str(&format!("({}) {}", log.created_at, log.msg));
+ ret.push_str(&format!("({}) {}", local_time, log.msg));
ret.push_str("
");
}
ret.push_str("");