Wybierz datę:

<form id="dateForm">
    <div>
        <legend>Wybierz datę:</legend>
        <div class="row">
            <div class="col-1-3">
                <select name="day"></select>
            </div>
            <div class="col-1-3">
                <select name="month"></select>
            </div>
            <div class="col-1-3">
                <select name="year"></select>
            </div>
        </div>
    </div>
    <div>
        <button type="submit" class="button">Pokaż datę</button>
    </div>
</form>

document.addEventListener("DOMContentLoaded", function() {
    const form = document.getElementById('dateForm');
    const months = ['styczeń','luty','marzec','kwiecień','maj','czerwiec','lipiec','sierpień','wrzesień','październik','listopad','grudzień'];
    const rok = (new Date()).getFullYear();

    const inputDay = form.querySelector('[name="day"]');
    const inputMonth = form.querySelector('[name="month"]');
    const inputYear = form.querySelector('[name="year"]');

    for (let x=0; x<31; x++) {
        const day = (x < 9)? '0'+(x+1).toString() : x+1;
        const newOption = new Option(day, x+1, 0, 0);
        inputDay.options[x] = newOption;
    }

    for (let x=0; x<12; x++) {
        const newOption = new Option(months[x], x+1, 0, 0);
        inputMonth.options[x] = newOption;
    }

    for (let x=0; x<3; x++) {
        const newOption = new Option(rok+x, rok+x, 0, 0);
        inputYear.options[x] = newOption;
    }

    function showValue() {
        let day = inputDay.options[inputDay.selectedIndex].value;
        day = (day < 10)?'0'+day.toString() : day;

        let month = inputMonth.options[inputMonth.selectedIndex].value;
        month = (month < 10)?'0'+month.toString() : month;

        const year = inputYear.options[inputYear.selectedIndex].value;

        return day + '-' + month + '-' +year;
    }

    document.querySelector('#dateForm').addEventListener('submit', function() {
        alert(showValue());
    });
});