Rename compare message dates to a more correct name; The method isn't message related anyway.
MODIFY
times/times.go
times/times.go
@@ -27,10 +27,8 @@ func TimeToString(time *time.Time) string {
return ""
}
-// CompareMessageDates returns true if the dates match, otherwise returns false
-func CompareMessageDates(t1, t2 time.Time) bool {
- if t1.Year() == t2.Year() && t1.YearDay() == t2.YearDay() {
- return true
- }
- return false
+// AreDatesTheSameDay returns true if the passed times represent the same day
+// of the year.
+func AreDatesTheSameDay(t1, t2 time.Time) bool {
+ return t1.Year() == t2.Year() && t1.YearDay() == t2.YearDay()
}

MODIFY
ui/chatview.go
ui/chatview.go
@@ -320,7 +320,7 @@ func (chatView *ChatView) AddMessage(message *discordgo.Message) {
wasScrolledToTheEnd := chatView.internalTextView.IsScrolledToEnd()
t1, _ := chatView.data[len(chatView.data)-1].Timestamp.Parse()
t2, _ := message.Timestamp.Parse()
- if !times.CompareMessageDates(t1.Local(), t2.Local()) {
+ if !times.AreDatesTheSameDay(t1.Local(), t2.Local()) {
fmt.Fprint(chatView.internalTextView, chatView.CreateDateDelimiter(t2.Format(chatView.format)))
}
@@ -348,7 +348,7 @@ func (chatView *ChatView) ReturnDateDelimiter(messages []*discordgo.Message, ind
t1, _ := messages[index-1].Timestamp.Parse()
t2, _ := messages[index].Timestamp.Parse()
- if !times.CompareMessageDates(t1.Local(), t2.Local()) {
+ if !times.AreDatesTheSameDay(t1.Local(), t2.Local()) {
res = chatView.CreateDateDelimiter(t2.Local().Format(chatView.format))
}
} else if index == 0 {

Rename compare message dates to a more correct name; The method isn't message related anyway.