From 24c0e66944b581571ee1268ebc313ca02c7bc66e Mon Sep 17 00:00:00 2001 From: FIGBERT Date: Mon, 27 Feb 2023 19:16:51 -0800 Subject: [PATCH] Fix timestamp rounding --- ui/view-roster.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/view-roster.go b/ui/view-roster.go index a7e15fa..68748da 100644 --- a/ui/view-roster.go +++ b/ui/view-roster.go @@ -140,10 +140,11 @@ func (rstr *RosterView) Draw(screen mauview.Screen) { } timestamp := room.LastReceivedMessage - day, _ := time.ParseDuration("24h") tm := timestamp.Format("15:04") - if timestamp.Before(time.Now().Round(day)) { - if timestamp.Before(time.Now().Round(day).AddDate(0, 0, -7)) { + now := time.Now() + today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) + if timestamp.Before(today) { + if timestamp.Before(today.AddDate(0, 0, -6)) { tm = timestamp.Format("2006-01-02") } else { tm = timestamp.Format("Monday")