From 84972581becdca49c017d0ba04dadc1500bcfd65 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 8 Jul 2020 19:06:13 -0700 Subject: Bugfix for wraparound weekdays (e.g. wed-sun) --- nowopen | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nowopen b/nowopen index 5df7214..502703e 100755 --- a/nowopen +++ b/nowopen @@ -121,8 +121,9 @@ for i,place in ipairs(places) do end local today_times for _,time in ipairs(place.times) do - if get_weekday(time.from) <= today.wday - and today.wday <= get_weekday(time.to or time.from) then + local from, to = get_weekday(time.from), get_weekday(time.to or time.from) + if (from <= to and from <= today.wday and today.wday <= to) -- no wraparound (e.g. mon-wed) + or (from > to and (today.wday >= from or today.wday <= to)) then -- wraparound (e.g. fri-tues) today_times = time end end -- cgit v1.2.3