It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Month Year Custom field

Hi All,

Is there a plugin in Jira which provides month year picker field, it will display the value something like this July 2013.

OR

how could we pick month and year from date picker field and display the result in a read only field?

If anyone could provide me an example of the same that would be very helpful.

Thanks and Regards,

Jenin C M

3 answers

1 accepted

0 votes
Answer accepted

Thanks all, I have achieved this via Calculated Custom Field.

Jenin

Hi @Jenin CM - Can you let me know the code for the same.

Thanks.

0 votes
Timothy Community Leader Sep 22, 2013

Well, the shoddy way is to create two select lists. One for month and one for year. To make it read only, only show the field in specific screens.

you can do this with the help of following code

Timestamp committedDate = (Timestamp)issue.getCustomFieldValue(cfm.getCustomFieldObjectByName("Committed Date"));
	    System.out.println(committedDate+" current committed date value");
	    if(committedDate!=null)
	    {
	    	System.out.println(new SimpleDateFormat("MMMM").format(committedDate)+"    month details 22");  
	    	System.out.println(new SimpleDateFormat("yyyy").format(committedDate)+"    year details 22");  
	    	issue.setCustomFieldValue(cfm.getCustomFieldObjectByName("MonYear"),new SimpleDateFormat("MMMM").format(committedDate)+" "+new SimpleDateFormat("yyyy").format(committedDate));
	    }
	    try
		{	
        	IssueManager issueManager4=comAcc.getIssueManager();
            
		    issueManager4.updateIssue(authenticationContext.getLoggedInUser(),issue,EventDispatchOption.ISSUE_UPDATED,true);
		    
		    comAcc.getIssueIndexManager().reIndex(issue);
		}
        catch(Exception e)
        {
        	e.printStackTrace(); 
		}

here Committed Date is of Date Picker type and MonYear is of Read Only Text Field.

you can place this in listener which catch for ISSUE_CREATED and ISSUE_UPDATED events.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you