cancel
Showing results for 
Search instead for 
Did you mean: 

How to show activity email feed dates as "days ago", "just now" etc

pcharsle
Confirmed Champ
Confirmed Champ

We are customizing our email template activities-email.ftl. The date of the activity is currently displayed using the following freemarker statement:

${activity.postDate?datetime?string.medium}

However, since many of our users are in different timezones we would like to display the date in a relative format, e.g "2 days ago", "3 hours ago", "1 week ago" etc.

We notice that activities displayed on the Alfresco Share activities dashlet are already displayed like this.

Does anyone know if there is an existing function that we can use to do this or do we have to create our own freemarker function in the template?

2 REPLIES 2

angelborroy
Community Manager Community Manager
Community Manager

You have to build it by yourself, as it's not supported by FreeMarker out-of-the-box:

Built-ins for date/time/date-time values - Apache FreeMarker Manual 

Hyland Developer Evangelist

angelborroy
Community Manager Community Manager
Community Manager

Alfresco is using a YUI JavaScript function to provide this feature:

https://github.com/Alfresco/share/blob/master/web-framework-commons/src/main/webapp/js/alfresco.js#L...

Hyland Developer Evangelist