Блондинка,
месяц в таблице, найди отличия)))
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>calendar-rotate</title>
<style type="text/css">
#calendar_rotate {
border: 1px solid hsl(0,0%,66%);
padding: 5px;
display: inline-block;
width: 373px;
}
#navigation_panel {
border: 1px solid hsl(0,0%,66%);
padding: 5px 10px;
margin: 0 0 5px 0;
display: inline-block;
white-space: nowrap;
}
#background_month {
background-color: hsl(210,100%,85%);
display: inline-block; }
#month_select {
background-color: transparent;
color: hsl(210,100%,45%);
font: 14px serif;
border: 1px solid hsl(210,100%,45%); }
.month {
border: 1px solid hsl(0,0%,66%);
display: flex;
flex-flow: column wrap;
justify-content: space-between;
width: 100%;
height: 367px;
padding: 1px;
}
.vert {
border: 1px solid #ff0;
height auto;
display: flex;
justify-content: space-between;
}
.vert .week {
width: auto;
border: 1px solid #090;
flex: 1 1 auto;
align-self: stretch;
}
.mont
.vert .week .day {
height 11.52%;
}
.month .week {
border: 1px solid #00a;
flex: 1 1 auto;
align-self: stretch;
width: 100%;
height: auto;
}
.month .week .day {
width 1.947em;;
height 1.85em;
}
.month,
.month.vert .week,
.day {
display: inline-block;
width: auto;
}
.month.vert .day {
display: block;
width: 1.85em;
}
.day {
border: 1px solid hsl(0,0%,66%);
width: 1.964em;
line-height: 30px;
text-align: center;
padding: 3.5px;
margin: 1px;
background-color: hsl(210,100%,90%);
color: hsl(210,100%,50%);
}
.day:nth-child(7n + 6), .day:nth-child(7n + 7) {
background-color: hsl(348,100%,90%);
color: hsl(348,100%,50%);
}
select {
width: 109px;
height: 29.5px;
}
input {
border: 1px solid hsl(0,0%,66%);
width: 54px;
height: 25.5px;display: inline-block;
text-align: center;
}
#month_minus, #year_minus {
width: 28px;
text-align: center;
border-radius: 12px 0 0 12px / 10px 0 0 10px;
margin: 0 -6px 0 0;
position: relative; top: 1.5px; }
#month_plus, #year_plus {
width: 28px;
text-align: center;
border-radius: 0 12px 12px 0 / 0 10px 10px 0;
margin: 0 0 0 -6px;
position: relative; top: 1.5px; }
#month_minus, #month_plus, #year_minus, #year_plus, #year_input {
background-color: hsl(210,100%,85%);
color: hsl(210,100%,45%);
font: 14px serif;
border: 1px solid hsl(210,100%,45%);}
</style>
</head>
<body>
<div id="calendar_rotate">
<div id="navigation_panel">
<button id="month_minus">◀</button>
<span id="background_month"><select id="month_select"></select></span>
<button id="month_plus">▶</button>
<button id="year_minus">◀</button>
<input id="year_input" type="number" size="4" value=""/>
<button id="year_plus">▶</button>
<button id="month_rotate">➙</button>
</div>
<table class="month vert"></table>
<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 += '<tr class="week">';
html += '<td class="day">' + this.days[i] + '</td>';
if (j == 6) html += '</td>';
}
this.element.innerHTML = html;
},
toggle: function() {
this.element.classList.toggle('vert');
},
};
var today = new Date(),
thisYear = today.getFullYear(),
thisMonth = today.getMonth();
calendar.days = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
selector = document.getElementById('month_select');
month_list = ['Январь', 'Февраль', 'Март', 'Апрель', ' Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'];
for (let i = 0; i < month_list.length; i++){
selector.options[i] = new Option(month_list[i], i);
}
selector.selectedIndex = thisMonth;
selector.addEventListener('change', load);
document.getElementById('year_input').addEventListener('change', load);
calendar.element = document.querySelector('.month');
document.getElementById('month_rotate').addEventListener('click', function() {
calendar.toggle();
});
function load(){
let year = document.getElementById('year_input').value;
let month = selector.selectedIndex;
calendar.update(year, month);
calendar.render();
}
document.addEventListener("DOMContentLoaded", ()=>{
document.getElementById('year_input').value = thisYear;
load();
});
</script>
</div>
</body>
</html>