diff --git a/assets/js/sportspress.js b/assets/js/sportspress.js index 4ab94b28..cfef48c3 100644 --- a/assets/js/sportspress.js +++ b/assets/js/sportspress.js @@ -21,9 +21,16 @@ function sp_viewport() { var countDownDate = new Date($(this).data('countdown')).getTime(); // Iterate every second var x = setInterval(function() { - + + // Get todays date and time + var now = new Date(); + + // Convert curent date and time to UTC + var tzDifference = now.getTimezoneOffset(); + var nowutc = new Date(now.getTime() + tzDifference * 60 * 1000); + // Find the distance between now and the count down date - var distance = countDownDate - (new Date); + var distance = countDownDate - nowutc; if ( distance < 0 ) { distance = 0; } @@ -109,4 +116,4 @@ function sp_viewport() { } }); -})(jQuery); +})(jQuery); \ No newline at end of file