Simple Day Countdown Script
This is a very simple script for counting down the days until something happens. It's quick and dirty and you don't need to include a big complex library with its own configuration. It doesn't handle timezones well, but you probably don't need it to ;)
{% raw %} Days Left {% endraw %}
Note: this requires jQuery
$(function() {
var date = new Date(Date.parse("Apr 1, 2030"));
var now = new Date();
var diff = date.getTime() / 1000 - now.getTime() / 1000;
var daysDiff = Math.floor(diff / 86400);
$(".coundown-timer").text(daysDiff);
});
<span class="coundown-timer"></span>
<script>
$(function() {
var date = new Date(Date.parse('Apr 1, 2030'));
var now = new Date();
var diff = date.getTime()/1000 - now.getTime()/1000;
var daysDiff = Math.floor(diff/86400);
$('.coundown-timer').text(daysDiff);
});
</script>