From 464ea64d78e6b31d2ea70e70aa02bdb974bd2dc6 Mon Sep 17 00:00:00 2001 From: delthas Date: Tue, 16 Aug 2022 08:41:42 +0200 Subject: Show the message date instead of its time on date change Fixes: https://todo.sr.ht/~taiite/senpai/17 --- ui/draw_utils.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ui/draw_utils.go') diff --git a/ui/draw_utils.go b/ui/draw_utils.go index 45e81db..3d04f11 100644 --- a/ui/draw_utils.go +++ b/ui/draw_utils.go @@ -42,6 +42,19 @@ func printNumber(screen tcell.Screen, x *int, y int, st tcell.Style, n int) { printString(screen, x, y, s) } +func printDate(screen tcell.Screen, x int, y int, st tcell.Style, t time.Time) { + _, m, d := t.Date() + d0 := rune(d/10) + '0' + d1 := rune(d%10) + '0' + m0 := rune(m/10) + '0' + m1 := rune(m%10) + '0' + screen.SetContent(x+0, y, d0, nil, st) + screen.SetContent(x+1, y, d1, nil, st) + screen.SetContent(x+2, y, '/', nil, st) + screen.SetContent(x+3, y, m0, nil, st) + screen.SetContent(x+4, y, m1, nil, st) +} + func printTime(screen tcell.Screen, x int, y int, st tcell.Style, t time.Time) { hr0 := rune(t.Hour()/10) + '0' hr1 := rune(t.Hour()%10) + '0' -- cgit v1.2.3