urish/angular-moment

Format Times Depending on Age

Closed this issue · 1 comments

How would one go about formatting times with angular-moment, depending on their age.

For example:

  • Within the last 24 hours: Yesterday at 9:18pm
  • Outside the last 24 hours: Oct 10, 10:15am
  • Outside the current year: Dec 4, 2012, 12:07pm

Is something like this possible?

Any help is appreciated. Thanks in advance!

urish commented

@realph You can use the fullDateThreshold configuration parameter, e.g.:

<span am-time-ago="message.time" am-full-date-threshold="7"></span>

for more information, please see the discussion in #75.