Confluence has been updated to version 6.15.9

This article shows how to synchronize the custom field of type Date/DateTime picker.

Jira Cloud and Jira Server use different data types to store the value of the Date custom field.

If you're exchanging the custom field value between different issue tracking platforms you need to transform the value into the proper type on the receiving side.

Below you can find the example of a simple date custom field synchronization which works for syncing custom field. 

Source side

Outgoing sync(Data Filter) 

To send the data use the code below  

replica.customFields."My Date CF" = issue.customFields."My Date CF"

Destination side  

Incoming sync(Create/Change processors)

issue.customFields."My Date CF".value = replica.customFields."My Date CF".value

If you synchronize the date custom field between Jira Cloud and Jira Server you need to transform the formatted date to the proper value type.

The example below shows how you can transform the received value to the timeStamp format on Jira Server. 

Jira Server 

Incoming sync(Create/Change processors)

// ======= Date CF ===============
import java.text.SimpleDateFormat;
import java.text.DateFormat;

def dateCustomFieldValue(replicaCustomField) {
    def datePattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; // define the desired date/time format
    String dateString = replicaCustomField.value;
    if (dateString) {
        dateString = dateString.replaceAll("\"","").trim();
        DateFormat formatter = new SimpleDateFormat(datePattern);
        date = formatter.parse(dateString);
        return date.toTimestamp();
    }
}

issue.customFields."My Date CF".value = dateCustomFieldValue(replica.customFields."My Date CF");
// ======= Date CF ===============


See also



Back to Custom fields synchronization