JavaScript HTML CSSconst $origin_day = document.querySelector('label:first-of-type > input')
const $last_day = document.querySelector('label:last-of-type > input')
$origin_day.onchange = () => {
if (!$origin_day.value) return;
const date = new Date($origin_day.value)
$last_day.value = new Date(date.getFullYear(), date.getMonth() + 1, 1)
.toISOString().slice(0, 10)
}
<div>
<label>In <input type="date"></label>
<label>Out <input type="date"></label>
</div>
div {
display: flex;
justify-content: space-around;
}
An entry from the gengns log, written by Génesis García Morilla · · HTML5, JavaScript