This issue is probably going to need to be broken down into a number of tasks/functions, so would be good to do as a pair/small team. You can then discuss amongst yourselves how to divide it up.
I'll leave it up to you to figure out how you want to do it exactly, but things you will probably need are:
[x] 1a) A function that takes in a date/time and returns out how much time remains until then (don't just hardcode it to calculate time to Christmas as we want to reuse the function for other dates later)
[x] 1b) Potentially, the function from 1a returns just a single number (seconds until), so another function is needed to convert this into Days/Hours/Minutes/Seconds.
[x] 2) A function that counts down one second at a time from the moment the site is loaded in the browser
[x] 3) A way of updating the DOM so that the days/hours/minutes/seconds tick down in real time - DONE: Just waiting on front end to be done to hook it all up properly
My thought is that countdowns will have the below object format.
{
name: "Christmas",
date: 20211225 //or however the date should be formatted, that's up to you!
time: 0000 //some countdowns will have specific times, but for dates like this we just use midnight
}
This issue is probably going to need to be broken down into a number of tasks/functions, so would be good to do as a pair/small team. You can then discuss amongst yourselves how to divide it up.
I'll leave it up to you to figure out how you want to do it exactly, but things you will probably need are:
My thought is that countdowns will have the below object format.