Hopefully a simple question. A user wants to "hide" date fields on a tab (rather than them appearing in the date section. The only way I can do this is to maintain a matching calculated text field that takes a copy of the date each time it changes, like this
if (issue.get("customfield_13503") != null) return issue.get("customfield_13503");
I then remove the actual date fields from the view screen. Only problem is the format of the date field appears as
"2018-08-13 00:00:00.0"
Any way of formatting this?
Hi Roy,
there are multiple ways to format the date according to your needs, such as:
if (issue.get("customfield_13503") == null)
return null;
return issue.get("customfield_13503").toLocaleString();
or to use Jira's default formatting:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.datetime.DateTimeFormatter;
import com.atlassian.jira.datetime.DateTimeStyle;
if (issue.get("customfield_13503") == null)
return null;
DateTimeFormatter dtf = ComponentAccessor.getComponent(DateTimeFormatter.class);
return dtf.withStyle(DateTimeStyle.DATE).format(issue.get("customfield_13503"));
and you can change the date time style using one of the constants here: https://docs.atlassian.com/software/jira/docs/api/7.2.9/com/atlassian/jira/datetime/DateTimeStyle.html
Awesome! thanks for the quick response. Exactly what I was looking for
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.