From 16223f2135a524e56853dac80decc3ecd12d0da8 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Mon, 16 Dec 2024 19:45:16 +0100 Subject: [PATCH] =?UTF-8?q?display=20pass=C3=A9/proche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- img.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/img.go b/img.go index 23d2e93..ecccc6e 100644 --- a/img.go +++ b/img.go @@ -340,8 +340,14 @@ func drawTCL(gc *draw2dimg.GraphicContext, title string, times []time.Time, now continue } delay := t.Sub(now).Truncate(time.Minute) + delayStr := "passé" + if delay > time.Minute { + delayStr = fmt.Sprintf("%v min", delay.Minutes()) + } else if delay > 0 { + delayStr = "proche" + } y := yoffset + float64(j+1)*35 - text(gc, fmt.Sprintf("%v min", delay.Minutes()), 22, x, y, fonts.Regular) + text(gc, delayStr, 22, x, y, fonts.Regular) } }