I'd like the moment().fromNow()
functionality, but when the date is close it is too precise - ex. I don't want it to show 'in 3 hours' but 'today' - so basically with a 'daily' precision.
I tried using the moment().calendar()
function, it doesn't format if the date difference is more than 1 day
I use a combination of
add()
andendOf()
with momentIn Moment.js, the from() method has the daily precision you're looking for:
I have similar solution, but allows to use locales: