(Solved) I see $datePickerFormatter.format($value) as 'Last Resolution Date'

Thomas Heidenreich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2011

Why does this happen, and what can I do?

3 answers

1 accepted

2 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2011

I think it happens when $value is null. Do a null check in the velocity template where the formatting is done and you should be fine!

Thomas Heidenreich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2011

The value should not be null, as it is a Last Resolution Date and the issue is resolved.

I didn't do anything but create a custom field as Last Resolution Date and added it to my view. Then I resolved a test issue and found that sting on the page.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2011

Might be an issue with JIRA version. See https://studio.plugins.atlassian.com/browse/JCHART-395 for a similar issue. I will raise a fault with JIRA Toolkit plugin if you are using it.

Thomas Heidenreich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 17, 2011

Thanks for pointing me to https://studio.plugins.atlassian.com/browse/JCHART-395 that solved the problem!

1 vote
grundic
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2011

Also I found another way to fix it without jira hackig:

1. Add constructor parameter private final DateFieldFormat dateFieldFormat;

2. Override getVelocityParameters method:

@Override
public Map<String, Object> getVelocityParameters(Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem) {
final Map<String, Object> map = super.getVelocityParameters(issue, field, fieldLayoutItem);
map.put("dateFieldFormat", dateFieldFormat);
return map;
}

For me it wasn't necesarry to put datePickerFormatter to velocity params (I run plugin SDK vith jira.version 4.4), but if you need it, you can add map.put("datePickerFormatter", dateTimeFormatterFactory.formatter().forLoggedInUser().withStyle(DateTimeStyle.DATE_TIME_PICKER));

Hope, it helps

0 votes
grundic
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2011

Thanks - got the same problem and the same answer!

But I saw on screenshot, that custom field placed in date area. My date CF is placed in main custom field area...

https://studio.plugins.atlassian.com/secure/attachment/18432/Jira+4.4+error+screenshot.jpg

How can I chanhge location of my custom field?

Thanks.

Suggest an answer

Log in or Sign up to answer