jQuery countdown hours/ minutes/ seconds throwing error nAn in Safari and iPhone

293 views Asked by At

I'm using jquery.countdown.js for a simple countdown clock. On Safari Desktop and Safari on iPhone I get an error for "Seconds" that reads NaN. It works on every other browser. Is there something I need to tweak?

Below is my code:

$(function () {
  $(".countdowntoChristmas").countdown({
    date: "December 24, 2020 24:00 EDT",
    render: function (data) {
      var el = $(this.el);
      totalHours = data.days * 24 + data.hours;
      el.empty()
        .append(
          "<span class='time time-h'>" +
            this.leadingZeros(totalHours, 2) +
            "</span>"
        )
        .append(
          "<span class='time time-m'>" +
            this.leadingZeros(data.min, 2) +
            "</span>"
        )
        .append(
          "<span class='time time-s'>" +
            this.leadingZeros(data.sec, 2) +
            "</span>"
        );
    }
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/easy-countdown/2.2.0/jquery.countdown.min.js"></script>

<div class="christmas-countdown">
  <div class="christmas-left">
    <strong
      >Its beginning to look a lot like<br />
      Christmas!</strong
    >
  </div>
  <div class="countdowntoChristmas"></div>
  <div class="christmas-right">
    Everywhere you<br />
    <strong>GO!</strong>
  </div>
</div>

0

There are 0 answers