как правильно использовать input type month и как установить переключение с дива на кнопку?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Calendar</title>
</head>
<body>
<style>
#calendar { width: 238px; height: 270px; padding: 3px; border: 1px solid #a9a9a9; }
#navigation_panel { width: 228px; padding: 3px; margin-bottom: 3px; border: 1px solid #a9a9a9; display: inline-block; }
.month,
.month.vert .week,
.day {
display: inline-block;
}
.month.vert .day {
display: block;
}
.day {
border: 1px solid #a9a9a9;
width: 30px;
line-height: 30px;
text-align: center;
margin: 1px;
}
input[type=month] { backgroud-color: #ffffff; border: 1px solid #a9a9a9; }
#switching { background-color: #fff; border: 1px solid #a9a9a9; }
</style>
<div id="calendar">
<div id="navigation_panel">
<input type="month">
<button id="switching">⇘</button>
</div>
<div class="month vert"></div>
<script>
var calendar = {
update: function(year, month) {
this.days.length = 7;
var stepDay = new Date(year, month, 1);
stepDay.setDate(stepDay.getDate() + 0 - ((stepDay.getDay() + 6) % 7));
var lastDay = new Date(year, month + 1, 0);
lastDay.setDate(lastDay.getDate() + 6 - ((lastDay.getDay() + 6) % 7));
while (stepDay <= lastDay) {
this.days.push(stepDay.getDate());
stepDay.setHours(24);
}
},
render: function() {
var html = '';
for (var i = 0, j = 0; i < this.days.length; j = ++i % 7) {
if (j == 0) html += '<div class="week">';
html += '<div class="day">' + this.days[i] + '</div>';
if (j == 6) html += '</div>';
}
this.element.innerHTML = html;
},
toggle: function() {
this.element.classList.toggle('vert');
},
};
var today = new Date(),
thisYear = today.getFullYear(),
thisMonth = today.getMonth();
calendar.days = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
calendar.element = document.querySelector('.month');
calendar.element.addEventListener('click', function() {
calendar.toggle();
});
calendar.update(thisYear, thisMonth);
calendar.render();
</script>
</div>
</body>
</html>