Formatting Dates

By default, date and datetime JIRA field values are printed as received from JIRA (e.g. "2006-01-02T15:04:05+0700"). You can customize date format adding ".formatted" suffix to field name, accompanied by format details as described below.

Formatting dates in predefined template

When using one of predefined email template formats (list, table or CSV), date fields can be formatted using one of following formats: RFC822, RFC822Z, RFC850, RFC1123, RFC1123Z, RFC3339, ANSIC, UnixDate.

To format date field, specify issue field (in the Query options) as <field_name>.formatted.<format>

For example: created.formatted.rfc822, updated.formatted.UnixDate

Formatting dates in custom template

In custom email templates you can format date/time using any valid time format layout, optionally converting time to IANA Time Zone specifying zone location (e.g. "America/New_York").

For example:

{{formatValueForReport $issue.Fields "updated.formatted" $self.JiraFields "Jan _2 15:04:05 MST" "America/New_York"}}

What happens here is that we invoke function formatValueForReport, passing to it:

  • the current issue fields data,

  • issue field name (where ".formatted" suffix means we want it formatted)

  • JIRA fields metadata (so the function can check the type of field)

  • date/time format layout

  • time zone location (optional)

For more examples see the custom email template sample.

For details about time format layout see Golang time package.

comments powered by Disqus