diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-07-08 19:06:13 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-07-08 19:06:13 -0700 |
| commit | 84972581becdca49c017d0ba04dadc1500bcfd65 (patch) | |
| tree | 51a2a77168b9b9ac488d5db8b43094fb5425487f | |
| parent | 98f64ed00be9735fbc76340c2687184d1f72d124 (diff) | |
Bugfix for wraparound weekdays (e.g. wed-sun)
| -rwxr-xr-x | nowopen | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 |
