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.

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

Yes, it does smart pluralization.

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

Not short enough for you?

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