v0.0.1
This commit is contained in:
38
web/lib/pages/stand/script.js
Normal file
38
web/lib/pages/stand/script.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const Stand = {
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user