summaryrefslogtreecommitdiff
path: root/public/js/moment-countdown.js
blob: 999cfcf55ac492ae9fa6707ffab01c07c3eb517d (plain)
1
2
3
4
5
6
7
8
9
10
11
$(document).ready(function() {
    $.each($('.moment-countdown'), function(i, e) {
        var span = $(e);
        var text = span.html();
        var timestamp = moment(parseInt(span.attr("data-timestamp") * 1000));
        span.html(text.replace("%c", timestamp.fromNow()));
        setInterval(function() {
            span.html(text.replace("%c", timestamp.fromNow()));
        }, 1000);
    });
});