From bfbecb87d9b94bcb1ca8444177cf0de89242d56d Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 9 Feb 2025 22:18:43 +0100 Subject: [PATCH] Display timestamp human readable --- src/storage.rs | 11 +++++++++++ templates/flake.html | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/storage.rs b/src/storage.rs index 5d815f3..2538966 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -2,6 +2,10 @@ use anyhow::{ Context, Result, }; +use chrono::{ + DateTime, + Utc, +}; use crate::utils::{ urlencode, }; @@ -147,6 +151,13 @@ impl RevisionRow { None => String::from("#"), } } + + pub fn last_modified_time(&self) -> Option> { + match &self.last_modified { + Some(last_modified) => DateTime::from_timestamp(last_modified.clone(), 0), + None => None, + } + } } #[derive(FromRow)] diff --git a/templates/flake.html b/templates/flake.html index 93cf39f..9189c91 100644 --- a/templates/flake.html +++ b/templates/flake.html @@ -11,7 +11,7 @@