In my development work, I often utilize momentJs to calculate the time difference between now and a specific date. Here is an example of how I use it:
moment([MyDate]).fromNow();
This code typically returns results such as:
"a few minutes ago" or "10 hours ago" ...
I once attempted to tweak the code to display the difference in seconds like so:
moment([MyDate]).fromNow().asSeconds();
Unfortunately, this adjustment didn't yield the desired outcome.
As a solution, I am interested in creating functionality similar to Twitter's last update notification. Any suggestions on how best to achieve this?