From 8c78128ace65c9ddc3748c7b7529c2de2bf97944 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sat, 1 Jun 2019 12:16:41 +1000 Subject: [PATCH] Revert "Merge pull request #329 from kadimi/patch-5" This reverts commit 62ddc695a960939bd0dd5246ef6e010426bb0ef2, reversing changes made to 72584a98f7a3f45f7e42e2d7e874c8d8ba9670f7. --- assets/js/sportspress.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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