The params string that indicates a time range
sched = "8:00AM-5:30PM"
There are start and end times stored in my database
client1.sched_start # => 2000-01-01 07:30:00 UTC
client1.sched_end # => 2000-01-01 17:30:00 UTC
client2.sched_start # => 2000-01-01 08:30:00 UTC
client2.sched_end # => 2000-01-01 16:30:00 UTC
How do I test whether a client time range is in the scheduled hours range, returning true or false?
So far, I have this, but I get true always and deprecation warnings plus it's really slow.
time_open = Time.use_zone('UTC'){Time.zone.parse '2000-01-01 '+sched.split("-")[0]}
time_close = Time.use_zone('UTC'){Time.zone.parse '2000-01-01 '+sched.split("-")[1]}
range = time_open..time_close
range === client1.sched_start && range === client1.sched_end
range === client2.sched_start && range === client2.sched_end
Here's an excerpt the warning
warning: Time#succ is obsolete; use time + 1
Also, the times are different formats. For example,
time_open # Sat, 01 Jan 2000 08:00:00 UTC 00:00
These were helpful in getting thus far: