I am trying to compare a string in the Format "HH:MM" with the local time.
I used the following code:
function update(time_string) {
now_datetime = new Date()
time_datetime = new Date(time_string)
var time = time_datetime.getHours() + ":" + time_datetime.getMinutes();
var today = now_datetime.getHours() + ":" + now_datetime.getMinutes();
console.log(time > today)
}
For some reasons, this produces different oucomes in Chrome and Safari. Safari adds two hours to the original time. Can anyone help me out how to make both browser produce the same results? Many thanks!