const Stand = { schedule: [], init: async () => { let html = await fetch('/lib/pages/stand/index.html').then((response) => response.text()); app.innerHTML = html; let listDate = [1, 4]; function generateAvailableDates() { let select = document.getElementById("dateSelect"); select.innerHTML = ""; let today = new Date(); today.setHours(0, 0, 0, 0); let months = [today.getMonth(), today.getMonth() + 1]; let year = today.getFullYear(); months.forEach(month => { let date = new Date(year, month, 1); while (date.getMonth() === month) { if (date >= today) { let day = date.getDay(); if (listDate.includes(day)) { let option = document.createElement("option"); option.value = date.toISOString().split("T")[0]; option.textContent = date.toLocaleDateString("uk-UA", { weekday: "long", year: "numeric", month: "long", day: "numeric" }); select.appendChild(option); } } date.setDate(date.getDate() + 1); } }); } // generateAvailableDates(); Stand.generator(); }, generator: () => { let block_schedule = document.getElementById('stand-schedule'); let html = ""; let stand = { id: 1, title: "Універсам", geo: { lat: 0, lng: 0 }, hour_start: 9, hour_end: 14, quantity_sheep: 4, week_days: [0, 2, 4, 6], processing_time: 0.5, updated_at: null } Stand.schedule = []; // Кількість годин служіння let stand_length = (stand.hour_end - stand.hour_start) / stand.processing_time; for (let z = 0; z < stand.week_days.length; z++) { Stand.schedule.push([]); let date = new Date(); date.setDate(date.getDate() + stand.week_days[z]); let dayName = date.toLocaleDateString('uk-UA', { weekday: 'long' }); html += `