In my timetable control code, I check if the current time is within the range of opening time and closing time. This is my code:
var ha = moment("00:00:00", 'H:mm:ss');
var hc = moment("23:59:00", 'H:mm:ss');
var hactual = moment("00:00:00", 'H:mm:ss');
var h_apertura = ha.format('HH:mm:ss');
var h_cierre = hc.format('HH:mm:ss');
var h_actual = hactual.format('HH:mm:ss');
if(h_apertura <= h_actual && h_actual <= h_cierre){
alert("ABIERTO \nhora de apertura: "+h_apertura+"\nhora de cierre: "+h_cierre+"\nhora actual:"+h_actual);
}else{
alert("CERRADO \nhora de apertura: "+h_apertura+"\nhora de cierre: "+h_cierre+"\nhora actual:"+h_actual);
}
in the control code that 00:00 is within the range of 00:00 and 23:59, my question is:
Is it possible for a company to open its business at 09:00 and close at 02:00 in the morning? if this is how I would do that control
I thank you in advance for your answers I attach my jsfiddle