Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

"ago" filter #611

Closed
vojtajina opened this issue Oct 20, 2011 · 15 comments
Closed

"ago" filter #611

vojtajina opened this issue Oct 20, 2011 · 15 comments

Comments

@vojtajina
Copy link
Contributor

Would be nice to have a filter to display timestamps in more "human" way, relatively to current time. Something like:

x seconds ago, a hours ago, etc...

Note, that the messages need to be localizable.

@TEHEK
Copy link
Contributor

TEHEK commented Oct 24, 2011

Is there a way to inject locale other than passing an optional value?

@vojtajina
Copy link
Contributor Author

I'm sorry, not sure I understand, what you mean...

Currently you can access service from filter through scope.$service('service-to-inject'); However, we are changing that so that you can inject into filters in the same way as into services...

@ijonlester
Copy link

This might seem like a silly question, but how would the $locale service work in this context? For example, I have the time date string 2011-10-25 21:32:00; I wrote a filter to format that into something friendlier like {{mydate|formatdate:"m/d/Y"}} to return a date like 10/25/2011. How would I use the $locale service within the filter to return a relative time like "3 minutes ago" into "hace 3 minutos"?

@TEHEK
Copy link
Contributor

TEHEK commented Oct 28, 2011

Not promising anything, but I have a nice idea that I'll try to implement this weekend. I think if we're doing "ago" we might also need something like "in future", which is essentially the same thing.

@btford
Copy link
Contributor

btford commented Jul 19, 2012

Is this still something that we're interested in adding to AngularJS core? If so, I can write one sometime.

@gregwebs
Copy link

google brings up someone claiming to already have written something similar: http://avalanche123.com/blog/2012/02/29/angularjs-superheroic-javascript-mvc-framework/

@rosskukulinski
Copy link

+1. I may hack together a one-off for a prototype we're building but may not be modularized enough for a pull-request.

@gregwebs
Copy link

I use momentjs: it has a from function.

@rosskukulinski
Copy link

Does it tie into angular data?

On Mon, Feb 18, 2013 at 3:53 PM, Greg Weber [email protected]:

I use momentjs: it has a from function.


Reply to this email directly or view it on GitHubhttps://github.com//issues/611#issuecomment-13749685.

@gregwebs
Copy link

I just call it from the view so it stays up to date: something more efficient could be made.

@lrlopez
Copy link
Contributor

lrlopez commented Feb 19, 2013

An alternative was discussed some months ago. You could also have a look into this: https://groups.google.com/forum/#!topic/angular/o7vl4tsg53w

There is a mention to momentjs at the end of the thread, although I haven't checked it yet.

@elgerlambert
Copy link

I could definitely use this, +1 from me!

@btford
Copy link
Contributor

btford commented Jun 10, 2013

this should probably be a separate Bower module

On Mon, Jun 10, 2013 at 6:33 AM, Elger Lambert [email protected]:

I could definitely use this, +1 from me!


Reply to this email directly or view it on GitHubhttps://github.com//issues/611#issuecomment-19191182
.

@pkozlowski-opensource
Copy link
Member

Agree with @btford

@btford btford closed this as completed Aug 24, 2013
@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants