From af9714ebd2edff02b4d5f89238dac5dffe1df6d1 Mon Sep 17 00:00:00 2001 From: Michal Katner Date: Wed, 2 Mar 2016 16:52:30 +0100 Subject: [PATCH] Improved showing any year in calendar widget. --- widgets/calendar.lua | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/widgets/calendar.lua b/widgets/calendar.lua index 0d29bdd..bbd6eed 100644 --- a/widgets/calendar.lua +++ b/widgets/calendar.lua @@ -59,18 +59,14 @@ function calendar:show(t_out, inc_offset, scr) month = month + calendar.offset - if month > 12 then - month = month % 12 - year = year + 1 - if month <= 0 then - month = 12 - end - elseif month < 1 then - month = month + 12 - year = year - 1 - if month <= 0 then - month = 1 - end + while month > 12 do + month = month - 12 + year = year + 1 + end + + while month < 1 do + month = month + 12 + year = year - 1 end calendar.notify_icon = nil -- 2.39.5