Time Comparison
I have two times
startTime: "18:10"
endTime: "18:55"
Now I want to compare the current time with these
So if the current time is before
startTime I want to return -1
If the current time is after the end time
I want to return 1
And if the current time is between start and end time
I want to return 0
I tried to implement using if else but it's getting to Complex and its not accurate too.
Can anyone help me build logic for this?
1 Reply
convert the time to unix timestamps, then it's super easy to compare