Skip to content

Commit

Permalink
Merge pull request #299 from Sitecore/fix/298-Countdown-UTC
Browse files Browse the repository at this point in the history
Fix #298
  • Loading branch information
sc-ivanlieckens authored Nov 30, 2023
2 parents 06f850c + 0205c54 commit c1cbe8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Project/MvpSite/rendering/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/2.0.2/anime.min.js"></script>
<script src="https://www.w3.org/TR/wai-aria-practices-1.1/examples/accordion/js/accordion.js"></script>
<script src="/js/mvp-site.js?v=1.6"></script>
<script src="/js/mvp-site.js?v=1.7"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion src/Project/MvpSite/rendering/wwwroot/js/mvp-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

const x = setInterval(function () {
let now = new Date().getTime();
let distance = countDownDate - now;
let nowUTC = new Date(now + new Date().getTimezoneOffset() * 60000);
let distance = countDownDate - nowUTC;
let days = Math.floor(distance / (1000 * 60 * 60 * 24));
let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
Expand Down

0 comments on commit c1cbe8b

Please sign in to comment.