26 lines
811 B
JavaScript
26 lines
811 B
JavaScript
window.addEventListener('load', () => {
|
|
setDateInput();
|
|
})
|
|
|
|
function setDateInput(){
|
|
document.querySelector('.arboretum-kontakt .date').setAttribute('type','date');
|
|
document.querySelector('.arboretum-kontakt .date').setAttribute('min',formatDate());
|
|
document.querySelector('.arboretum-kontakt .date').value=formatDate();
|
|
document.querySelector('.arboretum-kontakt .hour').value='7.30 - 15.30';
|
|
console.log(formatDate());
|
|
}
|
|
|
|
function formatDate() {
|
|
date = new Date();
|
|
var d = new Date(date.setDate(date.getDate() + 5)),
|
|
month = '' + (d.getMonth() + 1),
|
|
day = '' + d.getDate(),
|
|
year = d.getFullYear();
|
|
|
|
if (month.length < 2)
|
|
month = '0' + month;
|
|
if (day.length < 2)
|
|
day = '0' + day;
|
|
|
|
return [year, month, day].join('-');
|
|
} |