shkarol,
const formatter = new Intl.DateTimeFormat("ru", {
hour: "numeric",
minute: "2-digit"
});
const sleepTime = (str, back) => {
let [h, m] = str.split(":");
let time = new Date();
let arr = [];
let duration = back ? -90 : 90;
for (let i = 1; i < 7; i++) {
time.setHours(h, (+m + duration * i), 0, 0);
arr.push(formatter.format(time))
}
return back ? arr.reverse() : arr;
}
console.log(sleepTime('7:30', true));
console.log(sleepTime('23:40'));