Time ago filter?
Is there a way do a time ago filter on a date? I know there's a Rails helper that does it...
Comments are currently closed for this discussion. You can start a new one.
Log in to Harmony
Is there a way do a time ago filter on a date? I know there's a Rails helper that does it...
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Steve Smith on 10 Mar, 2011 06:05 PM
Because we cache your pages pretty aggressively, we don't allow time_ago style dating. Fortunately, there's a much better alternative than hard-coding the time_ago in your page (which will get old and inaccurate over the life of your page, even in a browser window over a few minutes.)
Support Staff 3 Posted by Steve Smith on 10 Mar, 2011 06:09 PM
Looks like my response didn't get fully included. Here's the rest:
By using something like http://timeago.yarp.com/ you can put the normal date in your page, along with the iso date (Harmony provides a filter for this) as an attribute, and JavaScript will turn that into a 'time ago.' If the user doesn't have javascript, they simply get the standard formatted date.
4 Posted by Eli Dupuis on 10 Mar, 2011 06:16 PM
Cool. Thanks for the tip.
Eli Dupuis closed this discussion on 10 Mar, 2011 06:53 PM.