aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnowopen5
1 files 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