Forums

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

How to correctly convert mediumDateTime to mediumDate

John Block
Contributor
September 10, 2024

I have a Custom field called "StartMaintenanceTime" which allows users to select a date and time in the format of MediumDateTime. My end goal is to have this add the incidents on my Project's calendar. The Calendar itself uses the fields "StartDate" and "DueDate" to populate.

My initial solution was to create an automation that copies the value from "StartMaintenanceTime" to the "StartDate" and "DueDate" fields. 

CalendarFix_1.pngCalendarFix_2.png

 

This solution works most times however I've found that in some cases the "StartDate" and "DueDate" values copied from "MaintenanceStartTime" are incorrect. Here is an example from one of my incidents that this occurs.

 

Incorrect_StartDate.png

 

I believe the issue is that Jira has trouble Copying a date that is in the mediumDateTime format to a field that is just mediumDate. My initial thought is that I could save a variable such as {{MaintenanceStartTime.mediumDate}} and then copy that variable to the "StartDate" and "DueDate" fields but I believe I may be doing that incorrectly.

 

I created a variable labeled {{MaintStart}} using the value {{MaintenanceStartTime.mediumDate}}. This however returns a value of none.MaintStart.png

 

update 9/11/24 : I am still working on a resolution. In one case I see the field for Maintenance Start time set as Sep 16, 2024, 9:30 PM. The automation runs that and it copies this field to the Start Date field. The result is  Sep 17, 2024 which is incorrect.

I've tried to SET the field to {{issue.Maintenance Start Time.mediumdate}} but that returns a value of "none".

1 answer

1 accepted

0 votes
Answer accepted
John Block
Contributor
September 16, 2024

Found the issue to be related to the Timezone users were submitting their changes in. I now have the start date being set with the following smart value to keep the dates accurate.

{{issue."Maintenance Start Time".convertToTimeZone("US/Eastern").jiraDate}}

Suggest an answer

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

Atlassian Community Events