I'm building an app where employees can Clock in and Clock out for their shift. But I'm stuck at the time comparison part. Small explanation about the function: Users have a set shift for example from 12:00 till 15:00. They should be able to use the clock in function 2 hours prior to the start time. So from 10:00 they are able to clock in. Also these shifts are planned way ahead so we have to check for the date to be correct and the time. I've been searching for a solution but haven't found one that fits my needs.
The only data I receive through a json is the following:
date: "2016-12-07", time: "05:00"
Summary: How can I check if your current time is 2 hours before the designated time?
NOTE: It has to be a 24h clock, so no PM AM ;-)
If I have to provide more information please let me know!