Hello, i have this countdown but but I would like it to start from one day of the week (Monday) and not from a complete date.Thank you so much.
export function button61_mouseIn(event) {
const bir = new Date();
const bor = bir.getDay();
const bard = bir.getHours();
$w(‘#text42’).hide();
$w(‘#text45’).show();
$w(‘#text46’).show();
if ((0 < bor && bor < 6 && bard < 18 && 7 < bard)) {
$w(‘#text45’).html = “
<Chiude tra
”;} else {
$w(‘#text45’).html = “
Apre tra
”;}
var countDownDate = new Date(“Dec 25,2018,8:00:00”).getTime(); // Countdown date and time
var CountdownDate2 = new Date(“Dec 25,2018,18:00:00”).getTime();
var countDownDate3 = new Date(“Dec 24,2018,8:00:00”).getTime();
var x = setInterval( function () {
var now = new Date().getTime();
var distance = countDownDate - now;
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
var distance2 = CountdownDate2 - now;
var hours2 = Math.floor((distance2 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes2 = Math.floor((distance2 % (1000 * 60 * 60)) / (1000 * 60));
var seconds2 = Math.floor((distance2 % (1000 * 60)) / 1000);
var distance3 = countDownDate3 - now;
var hours3 = Math.floor((distance3 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes3 = Math.floor((distance3 % (1000 * 60 * 60)) / (1000 * 60));
var seconds3 = Math.floor((distance3 % (1000 * 60)) / 1000); {
if (distance < 0) {
clearInterval(x);
$w(“#text46”).text = “…”;
}
if ((0 < bor && bor < 6 && 7 < bard && bard < 18)) {
$w("#text46").text = hours2 + "h " + minutes2 + "m "; // durante il lavoro vv
} **else if** ((4 < bor && bor < 6 && bard > 17)) {
$w("#text46").text = hours3 + "h " + minutes3 + "m "; //venerdì vv
} **else if** ((bor === 6)) { //sabato
$w("#text46").text = hours3 + "h " + minutes3 + "m ";
} **else if** ((bor === 0)) { //domenica
$w("#text46").text = hours3 + "h " + minutes3 + "m ";
} **else if** (2 < bor && bor > 0 && bard < 8) { //lunedì mattina
$w("#text46").text = hours + "h " + minutes + "m ";
} **else if** ((1 < bor && bor < 5) && (bard > 17)) { //dopo il lavoro
$w("#text46").text = hours + "h " + minutes + "m ";
} **else if** ((2 < bor && bor < 5) && (bard < 8)) { //prima il lavoro
$w("#text46").text = hours3 + "h " + minutes3 + "m ";
} **else** {
$w('#text46').text = ('Non disponibile');
}
}
})
}