Hi
I have a custom field which is a Date Picker field "Brag Last Updated" (custom field 11518) allowing a date range to be entered. An example of the content is
{"start":"2024-11-01","end":"2024-11-30"}
I want to work out the difference between the custom field 11518 above and {{now}} in days. Because the date picker contains a "start" and "end" date I want to only use the "start" date. I have tried various forms of the DateDiff function such as the following but they do not work:
{{issue.customfield_11518.diff({now}).days}}
Presumably the issue relates to the Date Picker (customer field 11518) containing 2 dates "start" and "end" and the the {{Now}} is a date time. I can reformat the {{now}} to a date only field using {{now.jiradate}}. But cannot find a way to convert the customfield 11518 to return a single date for use in the datefiff.
I have read a lot of previous articles but not yet found the solution. Can you help pleas
Hi @nick.pearson -- Welcome to the Atlassian Community!
That is the date format used by Jira Product Discovery (JPD), and the values are plain text in automation rules. Thus text functions must be used to extract the value needed (e.g., "start"), and converted using toDate before the diff() can occur.
For example:
{{issue.customfield_11518.match(".*start\":\"(.*)\",.*").toDate.diff(now).days}}
Kind regards,
Bill
Hi @Bill Sheboy thank you for taking the time to help me and for your suggestion. It worked perfectly.
Kind regards
Nick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn that helped! Please consider marking this question as "answered" to help others with a similar need find solutions faster. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.