0

I want to know how long ago a moment(date) is.

moment.duration(moment() - date)

Works, but I think it's a bit clunky. Is there a cleaner way of doing it? Can I otherwise extend duration with a method like this and should I?

Himmators
  • 14,278
  • 36
  • 132
  • 223
  • I think this one is answered [here](http://stackoverflow.com/questions/18623783/get-the-time-difference-between-two-datetimes) – Carlos Laspina Sep 22 '15 at 13:28
  • That looks even more complicated than my solution :) – Himmators Sep 22 '15 at 13:31
  • The only thing I can think of that would rely only on `moment` methods is this: `moment.duration( moment().subtract(date) )` but I am not sure it really improves on your code. Durations are context-less so you can't compare a date directly with it, I think. – tgo Sep 25 '15 at 10:11

0 Answers0