What date formats are accepted for smart value transformations?

Ylan Muller
Contributor
December 5, 2024

Hello,

We have data that is being sent to a Jira automation to create a ticket. One of the fields it sends is a date field formatted like "YYYY-MM-DD". We need to be able to manipulate that to use another format, such as the mediumDate format that is listed under date formats here:  

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

However, when I try to take a date in that format and manipulate it, it gets returned as a blank value. Here is an example from our sandbox where I store it as a variable then attempt to log the resulting value from the transform:

Screenshot 2024-12-05 at 4.43.16 PM.pngScreenshot 2024-12-05 at 4.43.06 PM.png

Are there certain formats it can't transform? Is there any workaround?

1 answer

1 accepted

5 votes
Answer accepted
Tomislav Tobijas _Koios_
Atlassian Partner
December 6, 2024

Hi @Ylan Muller ,

Just to clarify, you're sending info/data to Jira to create a new Jira ticket/issue? Or is it vice versa - trying to send data out of Jira to create a ticket in another system?

Anyhow, whenever a variable is created, the value within is created as a string/text. You would need to convert that value/text to date to use formatting options for dates.
Basically, something like the following might do the trick (you'll potentially need to adjust the format within toDate() function by your specific case).

2024-12-06_08-58-06.png

Btw, here's a similar question thread: Help converting variable to date

Hope this helps.

Cheers,
Tom

Ylan Muller
Contributor
December 6, 2024

Ah, that's what it is. I was thinking there was some type of string > date format problem, but couldn't find anything with my mediocre Google-fu. Thank you!

Ylan Muller
Contributor
December 6, 2024

I do want to note that in my testing, setting the date format in parentheses actually messed up the transform - dates like 2024-12-11 would become Dec 21, 2023, things like that. Using only toDate, such as {{DateVariable.toDate.longDate}} worked better for me.

Tomislav Tobijas _Koios_
Atlassian Partner
December 6, 2024

Glad you've managed to sort it out :)
Thanks for the update/info as well!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events