Month Year Custom field

Jenin CM September 22, 2013

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
Jenin CM September 29, 2013

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

Jenin

simarpreet singh June 22, 2020

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

Thanks.

1 vote
Bharadwaj Jannu
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.
September 23, 2013

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.

0 votes
Timothy
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.
September 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.

Suggest an answer

Log in or Sign up to answer