- Let's say I have a date string
2015-02-01
- (1st Feb 2015) - Today we have
2016-07-02
(2nd Jul 2016)
We can easily see that the older date took place approximately 1 year and 5 months and 1 day ago.
I wanted to achieve relative result like that using Moment.js, so I did:
return moment('2015-02-01').fromNow();
Unfortunately, library rounds the result and I get a year ago
, where almost half of the next year is ignored (missing 5 months and 1 day).
The only available boolean argument passed to .fromNow()
is nothing that can help. Is it possible to get full relative date where I could control breakdown even to hours, minutes and seconds if needed?