The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confluence user macro fromNow() function

Daz Daz
January 10, 2019

Hi guys,

I'm trying to beautify dates or simplify or whatever you call it. Instead of showing absolute datetime like 2019-01-01T08:00:00, it would be better if I show 5 days ago or Yesterday or 5 minutes ago and the likes. 

I am using Scriptrunner for JIRA and it is using groovy scripts. For .net I can use moment.js but not too sure for groovy script. If possible I do not want to do it the hard way and have hundred lines of code/logic just to translate absolute datetime to relative datetime. 

Any kind soul knows how to do this?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 11, 2019

Did you mean Scriptrunner for Confluence? Is this a question about Confluence or Jira? Also, user macros use velocity, not Groovy, so I'm unsure how you are trying to use ScriptRunner with a user macro if this is indeed for Confluence. What date specifically do you want to show as relative?

TAGS
AUG Leaders

Atlassian Community Events