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

support fromNow filter? #141

Open
ulion opened this issue Jun 18, 2015 · 2 comments
Open

support fromNow filter? #141

ulion opened this issue Jun 18, 2015 · 2 comments

Comments

@ulion
Copy link

ulion commented Jun 18, 2015

Or a more generic filter as https://libraries.io/github/dotSlashLu/moment-filter did?

I need display a datetime in the format "fromNow()" of moment returned, and a filter would be useful since I'm using it within ui-grid, not likely easy to embed directive into the cell, but filter is supported and easy to use.

@tony0918
Copy link

tony0918 commented Aug 3, 2015

Try amTimeAgo filter.

@bfowle
Copy link

bfowle commented Aug 29, 2015

👍 on this.

amTimeAgo does indeed work with future dates, but daysAgo is calculated as a negative value.
So if you want to show a full date past the amFullDateThreshold, daysAgo >= fullDateThreshold will always evaluate to false and will show "a month", "a year", etc. instead of the full date.

Simple hack: var showFullDate = fullDateThreshold && Math.abs(daysAgo) >= fullDateThreshold;

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

No branches or pull requests

3 participants