let nowTime = new Date();
let h = +nowTime.getHours() * 60;
let m = +nowTime.getMinutes();
let currentTime = h + m;
const condition1 = {
hourFrom: 0,
minuteFrom: 0,
hourTo: 8,
minuteTo: 59,
start1: function(){
return Number(this.hourFrom * 60 + this.minuteFrom)
},
end1: function(){
return Number(this.hourTo * 60 + this.minuteTo)
}
}
if (condition1.start1() <= currentTime || currentTime >= condition1.end1()) {
// код, для выполнения в этом промежутке времени!
}