I\'m unable to follow the Moment.js documentation, and need some help with setting it up. I\'ve referenced the moment.min.js
file properly on my webpage like so
Thanks to @JohannesKlauß for the code. This is basically how I executed his answer and how I am referencing the code on my website.
Where, moment.min.js is the Moment.js library, and moment.executor.js has this code (courtesy of Johannes):
jQuery(document).ready(function($){
var now = moment();
$('time').each(function(i, e) {
var time = moment($(e).attr('datetime'));
if(now.diff(time, 'days') <= 1) {
$(e).html('' + time.from(now) + '');
}
});
});
PS: You can actually edit moment.min.js and add the aforementioned code right in it, at the end. This way, you will be saving one additional HTTP request. :P