<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: HUG Countdown Module doesn't work on mobile. in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/208105#M8373</link>
    <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/68640"&gt;@therobert&lt;/a&gt;&amp;nbsp;- wow, good catch on testing the cache... glad you got it working&lt;/P&gt;</description>
    <pubDate>Thu, 20 Sep 2018 20:11:17 GMT</pubDate>
    <dc:creator>tjoyce</dc:creator>
    <dc:date>2018-09-20T20:11:17Z</dc:date>
    <item>
      <title>HUG Countdown Module doesn't work on mobile.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/202941#M7742</link>
      <description>&lt;P&gt;URL:&amp;nbsp;&lt;A href="http://northdallas.hubspotusergroups.com/ndhug" target="_blank"&gt;http://northdallas.hubspotusergroups.com/ndhug&lt;/A&gt;&lt;/P&gt;&lt;P&gt;ISSUE: The coundown module does not work on iphone in safari or chrome.&lt;/P&gt;&lt;P&gt;Is there something I am missing? &lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://community.hubspot.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hug-mobile.jpg" style="width: 200px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/11283i4F7D69344FDC3CCD/image-dimensions/200x299?v=v2" width="200" height="299" role="button" title="hug-mobile.jpg" alt="hug-mobile.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 21:43:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/202941#M7742</guid>
      <dc:creator>therobert</dc:creator>
      <dc:date>2018-08-21T21:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: HUG Countdown Module doesn't work on mobile.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/202952#M7745</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/68640"&gt;@therobert&lt;/a&gt;&amp;nbsp;- Your date is in an invalid format for IOS to handle. currently it looks like this:&lt;/P&gt;&lt;PRE&gt;2018-08-23 11:30:00&lt;/PRE&gt;&lt;P&gt;but, it needs to look like this:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;2018/08/23 11:30:00&lt;/PRE&gt;&lt;P&gt;So, you have to change a tiny part of your javascript, i'll highlight in bold.&lt;/P&gt;&lt;PRE&gt;var module_3107773 = (function() {
    var e = {};
    i18n_getmessage = function() {
        return hs_i18n_getMessage(e, hsVars.language, arguments)
    };
    i18n_getlanguage = function() {
        return hsVars.language
    };
    var c = document.getElementById("event_timestamp"),
        h = c.getElementsByClassName("countdown__days")[0].getElementsByClassName("countdown__digit")[0],
        g = c.getElementsByClassName("countdown__hours")[0].getElementsByClassName("countdown__digit")[0],
        f = c.getElementsByClassName("countdown__minutes")[0].getElementsByClassName("countdown__digit")[0],
        b = c.getElementsByClassName("countdown__seconds")[0].getElementsByClassName("countdown__digit")[0];
    var d = new Date(c.getAttribute("data-timestamp")&lt;FONT color="#339966"&gt;&lt;STRONG&gt;.replace(/-/g, "/")&lt;/STRONG&gt;&lt;/FONT&gt;).getTime();
    var a = setInterval(function() {
        var j = new Date().getTime();
        var n = d - j;
        var m = Math.floor(n / (1000 * 60 * 60 * 24));
        var i = Math.floor((n % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
        var k = Math.floor((n % (1000 * 60 * 60)) / (1000 * 60));
        var l = Math.floor((n % (1000 * 60)) / 1000);
        h.innerHTML = m;
        g.innerHTML = i;
        f.innerHTML = k;
        b.innerHTML = l;
        if (n &amp;lt; 0) {
            clearInterval(a);
            c.innerHTML = "EXPIRED"
        }
    }, 1000)
})();&lt;/PRE&gt;&lt;HR /&gt;&lt;P&gt;If this answer helped, please, mark as solved &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;tim@belch.io | &lt;A href="https://forms.belch.io" target="_blank"&gt;forms.belch.io&lt;/A&gt; | Design your own Beautiful HubSpot Forms; No coding necessary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Drop by and say Hi to me &lt;A href="http://slack.belch.io/" target="_blank"&gt;on slack&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 00:45:16 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/202952#M7745</guid>
      <dc:creator>tjoyce</dc:creator>
      <dc:date>2018-08-22T00:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: HUG Countdown Module doesn't work on mobile.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/203695#M7891</link>
      <description>&lt;P&gt;Just curious, why would I need to edit javascript? This is the&amp;nbsp;prebuilt hubspot module. It should work.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 22:11:54 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/203695#M7891</guid>
      <dc:creator>therobert</dc:creator>
      <dc:date>2018-08-24T22:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: HUG Countdown Module doesn't work on mobile.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/203734#M7895</link>
      <description>&lt;P&gt;Might be a question for the Devs...&lt;/P&gt;</description>
      <pubDate>Sat, 25 Aug 2018 13:03:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/203734#M7895</guid>
      <dc:creator>tjoyce</dc:creator>
      <dc:date>2018-08-25T13:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: HUG Countdown Module doesn't work on mobile.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/207905#M8329</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/2450"&gt;@tjoyce&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I was unable to find how to edit the js file which you posted above, but I found in the module in design tools how to edit some js associated with the next event module...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found the line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var countDownDate = new Date(eventEl.getAttribute('data-timestamp')).getTime();&lt;/PRE&gt;&lt;P&gt;I tried&amp;nbsp;editing this line to:&lt;/P&gt;&lt;PRE&gt;var countDownDate = new Date(eventEl.getAttribute("data-timestamp").replace(/-/g, "/")).getTime();&lt;/PRE&gt;&lt;P&gt;But it broke the time altogether. I think there is&amp;nbsp;some js happening before the page loads that is generating the timestamp and putting it on the div:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;div id="event_timestamp" class="hug-countdown" data-timestamp="2018-09-20 10:30:00"&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here&amp;nbsp;is&amp;nbsp;the js that I am able to edit:&lt;/P&gt;&lt;PRE&gt;var eventEl = document.getElementById('event_timestamp'),
    dayEl = eventEl.getElementsByClassName('countdown__days')[0].getElementsByClassName('countdown__digit')[0],
    hourEl = eventEl.getElementsByClassName('countdown__hours')[0].getElementsByClassName('countdown__digit')[0],
    minuteEl = eventEl.getElementsByClassName('countdown__minutes')[0].getElementsByClassName('countdown__digit')[0],
    secondEl = eventEl.getElementsByClassName('countdown__seconds')[0].getElementsByClassName('countdown__digit')[0];

var countDownDate = new Date(eventEl.getAttribute('data-timestamp')).getTime();
// var countDownDate = countDownDate.replace(/-/g, '/');
// var countDownDate = new Date(eventEl.getAttribute("data-timestamp").replace(/-/g, "/")).getTime();

// Update the count down every 1 second
var x = setInterval(function() {

  // Get todays date and time
  var now = new Date().getTime();

  // Find the distance between now an 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);

  // Display the result in the element with id="demo"
  dayEl.innerHTML = days;
  hourEl.innerHTML = hours;
  minuteEl.innerHTML = minutes;
  secondEl.innerHTML = seconds;


  // If the count down is finished, write some text 
  if (distance &amp;lt; 0) {
    clearInterval(x);
    eventEl.innerHTML = "EXPIRED";
  }
}, 1000);&lt;/PRE&gt;&lt;P&gt;Any suggestions would be appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 19:42:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/207905#M8329</guid>
      <dc:creator>therobert</dc:creator>
      <dc:date>2018-09-19T19:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: HUG Countdown Module doesn't work on mobile.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/207906#M8330</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/2450"&gt;@tjoyce&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I was unable to find how to edit the js file which you posted above, but I found in the module in design tools how to edit some js associated with the next event module...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found the line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var countDownDate = new Date(eventEl.getAttribute('data-timestamp')).getTime();&lt;/PRE&gt;&lt;P&gt;I tried&amp;nbsp;editing this line to:&lt;/P&gt;&lt;PRE&gt;var countDownDate = new Date(eventEl.getAttribute("data-timestamp").replace(/-/g, "/")).getTime();&lt;/PRE&gt;&lt;P&gt;But it broke the time altogether. I think there is&amp;nbsp;some js happening before the page loads that is generating the timestamp and putting it on the div:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;div id="event_timestamp" class="hug-countdown" data-timestamp="2018-09-20 10:30:00"&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here&amp;nbsp;is&amp;nbsp;the js that I am able to edit:&lt;/P&gt;&lt;PRE&gt;var eventEl = document.getElementById('event_timestamp'),
    dayEl = eventEl.getElementsByClassName('countdown__days')[0].getElementsByClassName('countdown__digit')[0],
    hourEl = eventEl.getElementsByClassName('countdown__hours')[0].getElementsByClassName('countdown__digit')[0],
    minuteEl = eventEl.getElementsByClassName('countdown__minutes')[0].getElementsByClassName('countdown__digit')[0],
    secondEl = eventEl.getElementsByClassName('countdown__seconds')[0].getElementsByClassName('countdown__digit')[0];

var countDownDate = new Date(eventEl.getAttribute('data-timestamp')).getTime();
// var countDownDate = countDownDate.replace(/-/g, '/');
// var countDownDate = new Date(eventEl.getAttribute("data-timestamp").replace(/-/g, "/")).getTime();

// Update the count down every 1 second
var x = setInterval(function() {

  // Get todays date and time
  var now = new Date().getTime();

  // Find the distance between now an 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);

  // Display the result in the element with id="demo"
  dayEl.innerHTML = days;
  hourEl.innerHTML = hours;
  minuteEl.innerHTML = minutes;
  secondEl.innerHTML = seconds;


  // If the count down is finished, write some text 
  if (distance &amp;lt; 0) {
    clearInterval(x);
    eventEl.innerHTML = "EXPIRED";
  }
}, 1000);&lt;/PRE&gt;&lt;P&gt;Any suggestions would be appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 19:44:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/207906#M8330</guid>
      <dc:creator>therobert</dc:creator>
      <dc:date>2018-09-19T19:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: HUG Countdown Module doesn't work on mobile.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/208034#M8360</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/2450"&gt;@tjoyce&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I understand the code you suggested and think that was the correct approach, but I&amp;nbsp;edited the js like you mentioned and the timer stopped working. I believe the timestamp is set by other js as the&amp;nbsp; page loads and not by the js that runs the module. The js that runs the module only grabs the timestamp and breaks it out into days, hours, minutes and seconds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the full js code I can edit:&lt;/P&gt;&lt;PRE&gt;var eventEl = document.getElementById('event_timestamp'),
    dayEl = eventEl.getElementsByClassName('countdown__days')[0].getElementsByClassName('countdown__digit')[0],
    hourEl = eventEl.getElementsByClassName('countdown__hours')[0].getElementsByClassName('countdown__digit')[0],
    minuteEl = eventEl.getElementsByClassName('countdown__minutes')[0].getElementsByClassName('countdown__digit')[0],
    secondEl = eventEl.getElementsByClassName('countdown__seconds')[0].getElementsByClassName('countdown__digit')[0];

var countDownDate = new Date(eventEl.getAttribute('data-timestamp')).getTime();
// var countDownDate = countDownDate.replace(/-/g, '/');
// var countDownDate = new Date(eventEl.getAttribute("data-timestamp").replace(/-/g, "/")).getTime();

// Update the count down every 1 second
var x = setInterval(function() {

  // Get todays date and time
  var now = new Date().getTime();

  // Find the distance between now an 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);

  // Display the result in the element with id="demo"
  dayEl.innerHTML = days;
  hourEl.innerHTML = hours;
  minuteEl.innerHTML = minutes;
  secondEl.innerHTML = seconds;


  // If the count down is finished, write some text 
  if (distance &amp;lt; 0) {
    clearInterval(x);
    eventEl.innerHTML = "EXPIRED";
  }
}, 1000);&lt;/PRE&gt;&lt;P&gt;Any further ideas would be much appreciated. Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 13:43:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/208034#M8360</guid>
      <dc:creator>therobert</dc:creator>
      <dc:date>2018-09-20T13:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: HUG Countdown Module doesn't work on mobile.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/208085#M8370</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/68640"&gt;@therobert&lt;/a&gt;&amp;nbsp;- That looks like you did it right, can you link me to the page after you adjusted that code? I would like to see the new error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 17:57:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/208085#M8370</guid>
      <dc:creator>tjoyce</dc:creator>
      <dc:date>2018-09-20T17:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: HUG Countdown Module doesn't work on mobile.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/208102#M8372</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/2450"&gt;@tjoyce&lt;/a&gt;&amp;nbsp;Hey, I think it is fixed now. I believe&amp;nbsp;the&amp;nbsp;page update time varies greatly with hubspot.&amp;nbsp;Most of the time, updates happen almost instantly after publishing changes. Sometimes, though, it is very slow- even after being fast all day. I think this was the issue after making the changes. I added an alert() just to see if anything was happening when i published changes. That alert() showed up for quite some time. Even after clearing cache/cookies/etc it was still showing. In a nutshell,&amp;nbsp;i have discovered updates aren't always updates haha. Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 19:51:40 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/208102#M8372</guid>
      <dc:creator>therobert</dc:creator>
      <dc:date>2018-09-20T19:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: HUG Countdown Module doesn't work on mobile.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/208105#M8373</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/68640"&gt;@therobert&lt;/a&gt;&amp;nbsp;- wow, good catch on testing the cache... glad you got it working&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 20:11:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HUG-Countdown-Module-doesn-t-work-on-mobile/m-p/208105#M8373</guid>
      <dc:creator>tjoyce</dc:creator>
      <dc:date>2018-09-20T20:11:17Z</dc:date>
    </item>
  </channel>
</rss>

