Permalink
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (19 sloc) 600 Bytes
title
Twitter

If you're trying to format times for tweets like the way Twitter does, you can use the moment.twitter plugin by @hijonathan.

It's a simple way to display both short and long versions of human-readable timestamps.

moment().subtract(5, 'hours').twitterLong();
// 5 hours

Yes, it does smart pluralization.

moment().subtract(1, 'hour').twitterLong();
// 1 hour

Not short enough for you?

moment().subtract(6, 'days').twitterShort();
// 6d