Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
Temporizador de cuenta regresiva de horas específicas

Estoy tratando de hacer un temporizador de cuenta regresiva que se muestre solo desde las 8 am hasta las 16 y luego muestre un mensaje durante 16 horas y repita el mismo ciclo todos los días. Tengo este código, pero realmente no entiendo qué tiene de malo. ¿Alguna recomendación?

Valorar. ¡Gracias!

 let getTom = () => { var tom = new Date(); tom.setDate(now.getDate() + (1 - now.getDay() % 1)); tom.setHours(16, 30, 0, 0); return tom; } window.onload = function() { var countDownDate = getTom(); let startCountdown = function() { // Countdown Timer var x = setInterval(function() { var now = new Date().getTime(); var distance = countDownDate - now; var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 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 time = days + " days, " + hours + "h, " + minutes + "m, " + seconds + "s "; document.getElementById("time").innerText = time; if (distance < 0) { clearInterval(x); document.getElementById("time").innerText = "test"; setTimeout(() => { startCountdown(); // set to 16h later countDownDate = countDownDate.getTime() + (1000 * 60 * 60 * 16); }, (1000 * 60)) // 1m test } }); startCountdown();}}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!