L a   C i g o g n e

Zimmer anfragen

Hotel


    Firmendaten (optional)





    document.addEventListener('DOMContentLoaded', function () { setMinDateForDateInputs(); }); /** * Set the curent date as min-value for dateinputs */ function setMinDateForDateInputs() { var currentDateFormatted = getFormattedDateFromDate(); document.querySelectorAll('.date-input-min-value').forEach(function(element) { element.setAttribute('min', currentDateFormatted); element.setAttribute('value', currentDateFormatted); }); } /** * Format the current Date */ function getFormattedDateFromDate() { var currentDate = new Date(); return [ currentDate.getFullYear(), tryAddLeadingZeroValue('' + (currentDate.getMonth() + 1)), tryAddLeadingZeroValue('' + currentDate.getDate()) ].join('-'); } /** * Add leading zero if required */ function tryAddLeadingZeroValue(value) { if(value.length < 2) { return '0' + value; } return value; }