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
You can compare only time in rails without date part like:---
Here post_review
is table and we are getting only these record of post_review
which are created_at
between 10 am ---5pm in any date
post_review.where("(created_at::time >= :start_time) AND (created_at::time <= :end_time)",
start_time: Time.parse("10 am").strftime("%r"),
end_time: Time.parse("5 pm").strftime("%r")
)