xaganic
5/1/2019 - 1:04 PM

Countdown

// Timestamp verilen belirli bir tarihten şuan ki zamana geri sayma:

// Function: 
spApi.widgets.countdown();

var targetDate = Math.round(new Date(2015, 09, 23, 23, 59).getTime() / 1000);

setInterval(function () {
    $countdown = spApi.widgets.countdown(targetDate);
    console.log($countdown)
}, 1000);


// İleri sayma (şuan ki zamana verilen gün,saat,dakika ekleyerek oluşan tarihten geri sayar):
var targetDate = {days:4, hours:2, minutes:7};
var currentTime = new Date();

setInterval(function(){
   $countdown = spApi.widgets.countdown(targetDate, currentTime);
   console.log($countdown)
},1000);