I\'ve searching the moment.js docs and stackoverflow for a way to use the fromNow() function but returning everything in hours.
What I mean is:
If you definitely want to use fromNow(), I don't see any way other than overriding moment's built-in function. For example, you can override it to return the difference in hours as follows:
moment.fn.fromNow = function (a) {
var duration = moment().diff(this, 'hours');
return duration;
}
Then you can check that fromNow() returns the value in hours:
console.log(moment([2017,0,6]).fromNow());
which returns:
19
Note: Tried at 19:00 :)