I am trying to create a countdown timer but I dont know how to make that.
My code is something like that :
Component.onCompleted: {
countdown("2018-12-31")
}
function countdown(startTime) {
var start = new Date(startTime);
var now = new Date();
var timeDiff = start.getTime() - now.getTime();
if (timeDiff <= 0) {
clearTimeout(timer);
document.write('Performance Started')
}
var seconds = Math.floor(timeDiff / 1000);
var minutes = Math.floor(seconds / 60);
var hours = Math.floor(minutes / 60);
var days = Math.floor(hours / 24);
hours %= 24;
minutes %= 60;
seconds %= 60;
var output = days + " days" + "," + hours + " hours, " + minutes + " minutes, " + seconds + " seconds."
timerSecs.text =seconds
return output;
var timer = setTimeout('cdtd()', 1000)
} But I dont know how an i make this timer repeats and works without stopping. Niyazi sen Türksün, Türkçe daha iyi anlaşırız yardım edersen sevinirim.