When creating an issue with 2 custom fields of type "Date Time" the date is saved in UTC format. The notification doesn't take into account the timezone displaying the time and date in UTC format.
We've created a new file named customFieldFrom.vm in /opt/jira/atlassian-jira/WEB-INF/classes/templates/email/html/includes/fields with the following content:
#if ($issue.getCustomFieldValue("customfield_10040")) <tr valign="top"> <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 10px 10px 0;white-space:nowrap;"> <!-- --> <strong style="font-weight:normal;color:${textSubtleColour};">From:</strong> </td> <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;"> $dateformatter.formatDMYHMS($issue.getCustomFieldValue("customfield_10040")) </td> </tr> #end
In /opt/jira/atlassian-jira/WEB-INF/classes/templates/email/html/issuecreated.vm we've added the following line:
#parse("templates/email/html/includes/fields/customFieldFrom.vm")
Our problem is the function $dateformatter.formatDMYHMS($issue.getCustomFieldValue("customfield_10040")) retrieves the UTC time. We need a function that also takes into account the timezone for the user that created the issue.
Any help would be highly appreciated. Thank you in advance
TimeZone timezone = timeZoneManager.getLoggedInUserTimeZone(); params.put("outlookDate", dateTimeFormatterFactory.formatter().withStyle(DateTimeStyle.DATE).forLoggedInUser().withZone(timezone));
.... in vm:
$outlookDate.format(YOUR_DATE)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.