From: Luke Bonham Date: Wed, 2 Mar 2016 16:53:03 +0000 (+0100) Subject: Merge pull request #176 from thinusbaun/any_year_in_calendar X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/42505f946ee6bac3f593c84e29a1bea923d07d02?hp=5f902517ffea8033605752f4755d81d4a9ba4aec Merge pull request #176 from thinusbaun/any_year_in_calendar Improved showing any year in calendar widget. --- 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