From 77bfc4cb7a159d2c5efecb42ca30a1917509d13e Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 5 Sep 2024 13:50:50 +0300 Subject: [PATCH] fix: add weekday to relative date formatting --- src/helpers.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/helpers.rs b/src/helpers.rs index 40a3fb2..8d836d5 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -1,7 +1,7 @@ use std::ops::Sub; -use chrono::{DateTime, Local, NaiveTime, TimeDelta, TimeZone, Utc}; use chrono::LocalResult::Single; +use chrono::{DateTime, Local, NaiveTime, TimeDelta, TimeZone, Utc}; use log::{debug, error, info, trace, warn}; use nostr_sdk::Timestamp; @@ -86,10 +86,10 @@ pub fn format_datetime_relative(time: DateTime) -> String { -1 => "tomorrow ".into(), 0 => "".into(), 1 => "yesterday ".into(), - -3..=3 => date.format("%a ").to_string(), - //-10..=10 => date.format("%d. %a ").to_string(), - -100..=100 => date.format("%b %d ").to_string(), - _ => date.format("%y-%m-%d ").to_string(), + //-3..=3 => date.format("%a ").to_string(), + -10..=10 => date.format("%d. %a ").to_string(), + -100..=100 => date.format("%a %b %d ").to_string(), + _ => date.format("%y-%m-%d %a ").to_string(), }; format!("{}{}", prefix, time.format("%H:%M")) }