aboutsummaryrefslogtreecommitdiffstats
path: root/docs/assets/js/fancydates.js
blob: d13b11b0ca9e3b13b04ebea740cdb789526630b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function fancydates(fanciness, date_format) {
    if (fanciness == 0) {
        return;
    }

    dates = $('time.published.dt-published');

    i = 0;
    l = dates.length;

    for (i = 0; i < l; i++) {
        d = moment(dates[i].attributes.datetime.value);
        if (fanciness == 1) {
            o = d.local().format(date_format);
        } else {
            o = d.fromNow();
        }
        dates[i].innerHTML = o;
    }
}