aboutsummaryrefslogtreecommitdiff
path: root/ui/messages/base.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2019-04-10 01:42:27 +0300
committerTulir Asokan <tulir@maunium.net>2019-04-10 01:42:27 +0300
commit06c306bee91ce2b7e7b5f32fad7c3f8b5b38d883 (patch)
treec5deabd2e86e3a40d86a7173a1a49c874ad99690 /ui/messages/base.go
parentbbde1219479bb257c7bc1f9546bd67e8a151198c (diff)
Fix date change messages and input submit handling
Diffstat (limited to 'ui/messages/base.go')
-rw-r--r--ui/messages/base.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/ui/messages/base.go b/ui/messages/base.go
index d9db866..f54c2cd 100644
--- a/ui/messages/base.go
+++ b/ui/messages/base.go
@@ -191,6 +191,12 @@ func (msg *BaseMessage) FormatDate() string {
return msg.MsgTimestamp.Format(DateFormat)
}
+func (msg *BaseMessage) SameDate(message UIMessage) bool {
+ year1, month1, day1 := msg.Timestamp().Date()
+ year2, month2, day2 := message.Timestamp().Date()
+ return day1 == day2 && month1 == month2 && year1 == year2
+}
+
func (msg *BaseMessage) ID() string {
if len(msg.MsgID) == 0 {
return msg.MsgTxnID