I have a data type, named Business Hours, in which there are fields of morningOpen, morningClose, eveningOpen and eveningClose. Yes, it’s something like business hours of a restaurant.
I am storing data from dropdown for each and the data source for the dropdown is list of split dates via Date and Time toolkit plugin for split dates for time slots, such as 11:00, 11:30, 12:00…
Each restaurant sets their business hours by selecting relevant time slots and the data is stored in date format. As a result, each data holds the calendar date value + time of the date when they set their business hours.
Problem to solve:
Now, every time the app runs, I want it to compare current date and time to restaurants’ business hour data and change the Business Open state to either Y or N, depending on if the current date and time falls within the business hours.
So, for example, if current date and time > morningOpen AND current date and time < morningClose, the restaurant Open state is Y, or it should be N. Or, I could use date range.
However, as each data for morningOpen, morningClose, eveningOpen and eveningClose contains the date of creation, I have no problem to see if current date and time is bigger than any stored values but cannot compare if current date and time is less than any stored values.
How can I solve this issue?
Thanks!