MCPcopy Create free account
hub / github.com/codemistic/Web-Development / renderCalendar

Function renderCalendar

dynamic-calendar/script.js:12–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10 "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];
11
12const renderCalendar = () => {
13 let firstDayofMonth = new Date(currYear, currMonth, 1).getDay(),
14 lastDateofMonth = new Date(currYear, currMonth + 1, 0).getDate(),
15 lastDayofMonth = new Date(currYear, currMonth, lastDateofMonth).getDay(),
16 lastDateofLastMonth = new Date(currYear, currMonth, 0).getDate();
17 let liTag = "";
18
19 for (let i = firstDayofMonth; i > 0; i--) {
20 liTag += `<li class="inactive">${lastDateofLastMonth - i + 1}</li>`;
21 }
22
23 for (let i = 1; i <= lastDateofMonth; i++) {
24
25 let isToday = i === date.getDate() && currMonth === new Date().getMonth()
26 && currYear === new Date().getFullYear() ? "active" : "";
27 liTag += `<li class="${isToday}">${i}</li>`;
28 }
29
30 for (let i = lastDayofMonth; i < 6; i++) {
31 liTag += `<li class="inactive">${i - lastDayofMonth + 1}</li>`
32 }
33 currentDate.innerText = `${months[currMonth]} ${currYear}`;
34 daysTag.innerHTML = liTag;
35}
36renderCalendar();
37
38prevNextIcon.forEach(icon => {

Callers 1

script.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected