I have a bar timetable with dynamic open and closing times and I have to calculate if currentTime falls within today’s opening hours.
The problem is the open and closing times aren’t in the same day. How does one calculate if currentTime falls within a range of specific times across multiple days?
I’m using jquery on this project.
You can calculate this using javascripts Date Object like :
would output opened until tomorrow 2am then it will output closed.
you can look at this JSBin Example and change the start time to see how it changes