I need to write a method that will check if Time.now
is in between the open hours and the close hours of a shop.
The open and close hours are saved as a Tim
There is a nice library https://github.com/bokmann/business_time which will do this and more for you.
BusinessTime::Config.with(beginning_of_workday: "8:30 am", end_of_workday: "5:30 pm") do
Time.now.during_business_hours?
end
It will do much more for you, like rolling a time to next or previous opening time, counting business hours between two timestamps, etc.