Forums

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

Confiform: Formatting dates pulled from Jira

Erin Smith
Contributor
January 27, 2021

I have a Confiform in Confluence that is populating fields based on information in a Jira ticket based on the Key the user fills in.

One of the fields is pulling in the Created Date which in Jira has the format dd/MMM/' 'yy HH:mm PM

We only want the date portion, but no matter how I use the "formatDate" function, or the "convertDate" function it won't pull the information into Confluence.

If I don't format it, I just put fields.created it populates the field in the form as: yyyy-MM-ddT16:28:02.860-0500

If I do try to format it, it leaves the field blank.

Any ideas on what I'm doing wrong or how I can pull just the date portion of the information from Jira?

3 answers

1 accepted

1 vote
Answer accepted
Alex Medved _ConfiForms_
Community Champion
January 28, 2021

Hi

Yes, there is a bit of a confusion ConfiForms is having and you need to help it with a parseDate function and Jira format for date/time field

fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ)

Then you can either format it or extract a timestamp

fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ).formatDate(yyyy-MM-dd)
fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ).timestamp

Hope it helps

Alex 

Erin Smith
Contributor
January 28, 2021

You Sir are a God.

Thank you so much, this is now working flawlessly.

0 votes
Info Developer March 21, 2023

Thanks Alex.

As you advised, I entered the parsed and formatted date below into the Field Name (see the first attached image):

myissue.fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ).formatDate(yyyy-MM-dd)

But, the date is still not formatted. See the second attached image. I don't know what I have done wrong

 Date Value entered into Field name.jpegTable View Output .jpeg 

Alex Medved _ConfiForms_
Community Champion
March 21, 2023

I see a different (and an expected) result

Screenshot 2023-03-21 at 15.42.20.png

Hard to "debug" your configuration by looking at these photos...

But did a quick test, following the advise given to Erin earlier and that works just as mentuined

In my screenshot the second column is a field with field name set to 

myissue.fields.created

And the 3rd column is the field with field name set to 

myissue.fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ).formatDate(yyyy-MM-dd)

myissue is the name of the field (Jira issue type) in my form

Alex

Info Developer March 21, 2023

Thanks for your prompt response, Alex.

I will try this again when my Confluence comes up, and get back to you

Info Developer March 21, 2023

Hi Alex,

I noticed my mistake: Instead of single colon, I entered double colon between "ss" and "SSSZ". (ss:SSZ)

I changed it to single colon (ss.SSZ), and it is working now

Thanks so much!

0 votes
Info Developer March 20, 2023

Please, how do I format the Created Date (mentioned by Erin Smith) in "ConfiForms Form Field" Macro?

In the Macro, I entered myissue.fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ) as the field name, and yyyy-MM-dd inside the Override output format text box. 

But, the format is not changing to yyyy-MM-dd.

 

Kindly assist 

Alex Medved _ConfiForms_
Community Champion
March 21, 2023

Hi

You do it by parsing and formatting the date as explained in my earlier comment to Erin

myissue.fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ).formatDate(yyyy-MM-dd)

Alex

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events