I have a function that checks if the current time is within the opening time. My problem is that I am unsure if it is the right approach.
The function accepts the following parameters: string $range and string $now.
$range = "08:00-12:00";
$now = "09:33";
function isOpen(string $range, string $now): bool {}
My approach:
I convert each individual time to a number. (hours * 60) + minutes. This way I can compare the times. It works and I have not found any problems in the current tests. There are, as so often, several approaches. I would be interested to know which approach you would choose?
Thanks in advance!!