an error with the date selection. When I select a day in the calendar, the month is recorded and I cannot select more than 12. For example, I select January 12, but December 1 comes on the date. Help me please. I think the whole problem is that I create a date and I need to make a date instance
function nextmonths() {
var start_multi = new Date(document.getElementById("date__start").value);
var next_date_unformatted = start_multi;
var next_date_formatted;
var next_date;
next_date = new Date(next_date_unformatted);
console.log(next_date)
next_date_formatted = next_date.toLocaleDateString()
document.getElementById("date__end").value = next_date_formatted;
dateSelected.innerHTML = 'С' + ' ' + start_multi + ' ' + 'по' + ' ' + next_date_formatted;
}
<link href="https://github.com/t1m0n/air-datepicker/blob/v3/dist/air-datepicker.css" rel="stylesheet" />
<script src="https://github.com/t1m0n/air-datepicker/blob/v3/dist/air-datepicker.js"></script>
<div class=" d-flex flex-column ">
<label for="" class=" insurance__program-label mb-lg-1 mb-1">Дата начала страховки:</label>
<input type="text" id="date__start" class="dates__form insurance__program-aria" placeholder="06.01.2023">
</div>
<div class="d-flex flex-column mt-lg-2 ">
<label for="" class="mt-lg-2 mt-3 insurance__program-label mb-lg-1 mb-1">Дата окончания страховки:</label>
<input type="text" id="date__end" class="dates__form insurance__program-aria" placeholder="12.06.2023">
</div>