const start = 11 * 60 * 60;
const end = 18 * 60 * 60;
const step = 30 * 60;
const count = Math.floor((end - start) / step);
const result: string[] = [];
const date = new Date();
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
date.setMilliseconds(0);
const format = (date: Date) => date.toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit' });
for (let index = 0; index < count; index++) {
const from = new Date(date.getTime() + (start + step * index) * 1000);
const to = new Date(date.getTime() + (start + step * (index + 1)) * 1000);
result.push(`${format(from)} - ${format(to)}`);
}
console.log(result);
/* [ '11:00 - 11:30', '11:30 - 12:00', '12:00 - 12:30', '12:30 - 13:00', '13:00 - 13:30',
'13:30 - 14:00', '14:00 - 14:30', '14:30 - 15:00', '15:00 - 15:30', '15:30 - 16:00',
'16:00 - 16:30', '16:30 - 17:00', '17:00 - 17:30', '17:30 - 18:00' ] */