I have been trying to implement this code on a page on my site for my wedding cupels so they can see how many days they would have left until there wedding day but have had no luck with the timer connecting with my datasets
I did not write this code myself,
import wixWindow from 'wix-window';
import wixData from 'wix-data';
$w.onReady( () => {
$w("#dynamicDataset").onReady( () => {
let itemIndex = $w("#dynamicDataset").getCurrentItem();
} );
} );
let eventDate = new Date("Dec 29,2020 14:00:00").getTime();// Countdown date and time
let eventDate = setInterval(function () {
let now = new Date().getTime();
let timeLeft = eventDate - now;
let days = Math.floor(timeLeft / (1000 * 60 * 60 * 24));
let hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
let minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60));
let seconds = Math.floor((timeLeft % (1000 * 60)) / 1000);
$w("#days").text = "" + days;
$w("#hours").text = "" + hours;
$w("#minutes").text = "" + minutes;
$w("#seconds").text = "" + seconds;
}
, 1000);
I Belive this is the part of the code that I need to connect with my data set
let eventDate = new Date("Dec 29,2020 14:00:00").getTime();// Countdown date and time
any help would be muchly appreciated
Thanks
Lucas