Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Countdown Timer not displaying correctly on mobile - NAND NANM NANH NANS


D_Roca

Question

Site URL: http://savingmyanmar.com

Put together a teaser landing page for our site launch with a countdown timer. Everything seems to function properly when viewing the desktop version AND when testing the mobile version on Desktop, but once I pull up the page on my actual mobile device, the numbers all display NAND NANH NANM NANS.

I understand that that stands for Not Available Number Day, .... Hours..... Minutes.... Seconds....

Here is my code. Can anyone help?

Quote

<html>
<h2>
<head>
<style>
body {
    text-align: center;
}
</style>
</head>
<body>
<p id="demo"></p>
  
<script>
// Set the date we're counting down to
var countDownDate = new Date("05/01/2021 24:00:00").getTime();

// Update the count down every 1 second
var x = setInterval(function() {

  // Get today's date and time
  var now = new Date().getTime();    
    
  // Find the distance between now and the count down date
  var distance = countDownDate - now;
    
  // Time calculations for days, hours, minutes and seconds
  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);
    
  // Output the result in an element with id="demo"
  document.getElementById("demo").innerHTML = days + "d " + hours + "h "
  + minutes + "m " + seconds + "s ";
    
  // If the count down is over, write some text 
  if (distance < 0) {
    clearInterval(x);
    document.getElementById("demo").innerHTML = "IT'S TIME!";
  }
}, 1000);
</script>
</body>
</h2>
</html>

 

IMG_0FB1DD226210-1.jpeg

Link to post
  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Posted Images

3 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...