properly account for future/past dates when humanizing with moment

This commit is contained in:
Drewster727 2016-04-05 13:49:05 -05:00
commit 4c82f4d821
2 changed files with 8 additions and 2 deletions

View file

@ -8,6 +8,12 @@
return s;
}
function Humanize(date) {
var mNow = moment();
var mDate = moment(date).local();
return moment.duration(mNow - mDate).humanize() + (mNow.isBefore(mDate) ? ' from now' : ' ago');
}
function generateNotify(message, type) {
// type = danger, warning, info, successs
$.notify({