Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

feat(amTimeAgo): add am-time-ago-formatter attribute #198

Closed
wants to merge 1 commit into from

Conversation

andreialecu
Copy link

Adds optional am-time-ago-formatter which can take a function to alter the displayed text
based on custom logic. Example:

<span am-time-ago="message.time" am-time-ago-formatter="customFormatter(message.time)"></span>
$scope.customFormatter = function(date) {
   // any date within 5 minutes from now or in the past will be displayed
   // as 'in a few moments'
   if (date > Date.now() - 5 * 60000) {
      return 'in a few moments';
   }
};

Fixes:
#44
#153

Adds optional `am-time-ago-formatter` which can take a function to alter the displayed text
based on custom logic. Example:

```js
$scope.customFormatter = function(date) {
   // any date within 5 minutes from now or in the past will be displayed
   // as 'in a few moments'
   if (date > Date.now() - 5 * 60000) {
      return 'in a few moments';
   }
};
```
@angelxmoreno
Copy link

we ever going to merge this?

@alex88
Copy link

alex88 commented Aug 30, 2016

this would be great!

@shirazSalpo
Copy link

How can i get the angular-moment version with m-time-ago-formatte

@andreialecu andreialecu closed this May 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants