Rozumiem że ten kod powinien wyglądać tak?:
function getDate() {
const txtInDiv = document.getElementById('counter');
const date = new Date();
const comingDate = new Date("January 1, 2022 00:00:00");
const day = date.getTime();
const month = date.getTime() + 1;
const year = date.getTime();
const hours = date.getTime();
const minutes = date.getTime();
const seconds = date.getTime();
if (month < 10) {
txtInDiv.innerHTML = 'Dziś jest ' + day + '.' + '0' + month + '.' + year + ' . Teraz jest godzina ' + hours + ':' + minutes + ':' + seconds + ' . Odliczanie do ' + comingDate + '';
} else {
txtInDiv.innerHTML = 'Dziś jest ' + day + '.' + '0' + month + '.' + year + ' . Teraz jest godzina ' + hours + ':' + minutes + ':' + seconds + ' . Odliczanie do ' + comingDate + '';
}
}
function currentDate() {
const myDate = setInterval(getDate, 1000);
return myDate;
}
currentDate();
Pytam bo chce mieć 100% pewność. Za nic nie dawaj mi kodu