Fix timestamp rounding

This commit is contained in:
FIGBERT 2023-02-27 19:16:51 -08:00
parent 2a01fdb559
commit 24c0e66944
No known key found for this signature in database
GPG key ID: 67F1598D607A844B

View file

@ -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")