Alan Alan - 7 months ago 29
Javascript Question

How to convert String h:m to hour format?

So I have a JSON object that looks like this,

{"active": "1", "opening": "11:00", "closure": "20:00"}

and a user input that is a String that is current time in h:m format, example:


How can I convert user's input to hour time and compare it against opening and closure. I want to do

if(closure > input && input > opening){
... }

So how do i do it?


Time in the hh:mi format is comparable as-is.